Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9102997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:31:24+00:00 2026-06-17T01:31:24+00:00

i started learning jQuery and i wish to know why jquery methods cannot be

  • 0

i started learning jQuery and i wish to know why jquery methods cannot be applied

in this example :

$('p')[0].html('salut !'); //for this instruction i got this error :
                           //"TypeError: $(...)[0].html is not a function "

while this one works :

$('body')[0].tagName.toLowerCase();

i m confused and i wish to know what is the difference between these 2 cases.

here is another example for the same problem :

var listItems = $( 'li' );
var rawListItem = listItems[0]; // or listItems.get( 0 )
var html = rawListItem.html();
// Object #<HTMLInputElement> has no method 'html'

here is the way on how to use jquery methods by using the .eq() :

var listItems = $( 'li' );
var secondListItem = listItems.eq( 1 );
secondListItem.remove();

thanks for supplying some explanation for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:31:25+00:00Added an answer on June 17, 2026 at 1:31 am

    A jQuery object is completely different to a DOMElement.

    • jQuery objects let you perform jQuery operations of them. html(), val(), eq(), etc.
    • DOMElement‘s… don’t. As they’re DOMElements, not jQuery objects.

    If you check the documentation for .get(), you’ll see you get a DOMElement back, not a jQuery object. The same goes for [0] etc.

    eq(), however, returns a jQuery object which lets you do jQuery operations on them.

    tagName is a DOMElement attribute, which is why can perform it on the DOMElements returned by get(), but can’t perform it on the jQuery objects returned by eq(). The opposite applies for html() when used on get() and eq().

    You can, of course, wrap any DOMElement in a jQuery object via $(), which’ll let you perform jQuery operations on it;

    $($('p')[0]).html('salut !');
    

    But in your situations, you should be using eq():

    $('p').eq(0).html('salut !');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started learning Jquery mobile, I followed this http://dev.jtsage.com/jQM-SimpleDialog/demos/string.html . Nothing happens when I
I started learning OOP applied to C++. Now I want to know if I
I've just started learning jQuery/javascript, so this might seem like a really basic question,
$('.button').click(function(){ $(this).toggleClass('clicked') $('.clicked+span').toggleClass('choice'); }); I've just started learning jQuery and I was playing around
I just started learning Jquery and am making an div sliding menu, this is
First I should say I only started learning HTML,PHP,Jquery a couple of weeks ago
I've just started learning Jquery but the examples aren't helping me much... Now whats
I have just started learning Jquery and am new to writing javascript (I am
Hey Guys I am in the process of learning JQuery and I started using
I started learning jQuery just yesterday, and I like it very much. And now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.