What is the difference between eq() and get() methods in jQuery?

Answer Posted / chaitanya

eq() returns the element as a jQuery object. This method constructs a new jQuery object from one element within that set and returns it. That means that you can use jQuery functions on it.

get() return a DOM element. The method retrieve the DOM elements matched by the jQuery object. But as it is a DOM element and it is not a jQuery-wrapped object. So jQuery functions can't be used. Find out more here.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to execute jQuery code after the DOM is ready?

642


What are the types of selectors that are used in jquery? Give examples.

656


How to Use the jQuery load() Method?

704


How to always reference latest version of jquery?

626


Explain event.preventdefault? : jquery mobile

647


Explain type paremeter of jquery ajax method?

601


Where jQuery code is getting executed?

703


Which program is useful for testing jQuery?

647


How to use jquery library in our asp.net project?

605


List the advantage of using minimized version of jquery?

586


How can images be made to appear scrolling one over another?

617


What is the use of css() method in jquery?

656


Explain the basic need to start with jquery? : jquery mobile

590


How to use it jquery knockout?

653


Give a brief idea about jquery mobile? : jQuery Mobile

581