Javatpoint Logo
Javatpoint Logo

jQuery even() method

The even() method in jQuery is used to select the elements with even index numbers (such as 2, 4, 6, etc.). The index starts with 0. It works similar to the odd() method, but it selects even numbers.

The even() method returns the even indexed elements from the set of selected elements. This method is used without any arguments.

Syntax

It does not accept any parameter.

Let's see some of the illustrations to understand the working of the even() method.

Example1

It is a simple example of using the even() method. In this example, we are using the even() method to select the list items with an even index. There are ten list items starting from 0 to 9. The index starts from 0. So, on clicking the given button, the method will select the list elements that appeared on even index values.

We have to click the given button to see the effect.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery even() method

After clicking the given button, the output will be -

jQuery even() method

Example2

It is another example of using the even() method. In this example, there are some checkboxes. We are using the even() method to select the even checkboxes. Here, there are six checkboxes starting from the zero indexes. The index starts from 0. So, on clicking the given button, the method will select the checkboxes that appeared on even index values.

We have to click the given button to see the effect.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery even() method

After clicking the given button, the output will be -

jQuery even() method





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA