VOOZH about

URL: https://www.geeksforgeeks.org/jquery/jquery-eq-method/

⇱ jQuery eq() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

jQuery eq() Method

Last Updated : 11 Jul, 2025

The eq() method is an inbuilt method in jQuery that is used to locate the selected elements directly and returns an element with a specific index. 

Syntax:

$(selector).eq(index)

Parameters: Here the parameter "index" specifies the index of the element.
Can either be positive or a negative number. 

NOTE:

  • The index number always starts at 0, so the first number will have index 0 (not 1).
  • Using a negative number as an index starts the index count from the end of the list.

jQuery code to show the working of the eq() method:

Example 1: Below code will select the specified elements. 

Output:

 👁 Image
 

Example 2: Below code will select the specified elements with negative index. 

Output:

 👁 Image

jQuery : eq() vs get():

  • .eq() returns it as a jQuery object, meaning the DOM element is wrapped in the jQuery wrapper, which means that it accepts jQuery functions.
  • .get() returns an array of raw DOM elements.
Comment
Article Tags:

Explore