jQuery eq() Method

Last Updated Jul 21, 2015, 12:00:06 PM





jQuery eq() Method

jQuery eq() method selects a HTML element with a specific index number.

As we know that index starts from 0 not from 1.jQuery eq() method also start it’s index from 0 to select an element. Here index represents that position of the element in the group.

The following example has five div HTML elements in which we can see selecting a particular element by calling eq( 2 ) method by passing the position of that element.

Example HTML

jQuery

Notice that the indexes start with 0, so the third element would be the second one

Output
jquery eq() method

Try It Now


Other Advanced jQuery Traversing Methods you might want to learn

jQuery Traversal Reference

jQuery Basic Traversing

jQuery Traversal Filters

jQuery Traversing Methods



Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM