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 can you apply a style on an element using jQuery?

461


Define width() vs css('width')?

481


How do you install/use jquery in a project. What is the minimum setup needed to start using jquery.

457


How to execute jQuery code after the DOM is ready?

479


What are the different type of selectors in jquery?

449






Name some of the methods of jquery used to provide effects?

444


What is $() in jquery library?

466


How do you install/use jquery in a project.

479


Define jquery connect?

504


Can you use multiple document.ready() function on the same page?

500


Explain animate function in jquery?

442


Explain url paremeter of jquery ajax method?

8611


How can we apply css in div using jquery?

503


How method can be called inside code behind using jQuery?

456


How to write browser specific code using jquery? : jquery mobile

468