I\'m new to jQuery, and I\'m wondering what the difference is between jQuery\'s get() and eq() functions. I may misunderstand what the get()
Answers above have explained specificly and correctly. I want to add a few points here that might help for the use of get().
If you don't pass an argument to .get(), it will return an Array of the DOM elements.
If you got a DOM object using get(), like
var s = $("#id").get(0)
you can turn it back into jQuery object simply by using this, $(s)
You can use $obj[i] as an alternative way if you don't want to use $obj.get(i), see below,
var $obj = $("#ul li");
var obj1 = $obj.get(1);
var obj2 = $obj[1];
//true
return obj2===obj1;
To build on the other answers:
$('h2').get(0) === $('h2').eq(0)[0] //true
$( $('h2').get(0) ) === $('h2').eq(0) //true