Yogesh Chauhan's Blog

Use eq() method in jQuery

in jQuery on May 30, 2021

The eq() method is pretty useful when it comes to target specific element in a group of elements. It’s really easy to use since you can target element using an index.


.eq( index )

Where index is the position of the element.

You can define an index from the beginning (a positive number) or from the end (a negative number).

Just like this:

This is how it will change the style of the elements:

If element is not available at the specified index, it won’t do anything.

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
A Step by Step Guide to Make RSS in XML For Any Website or Blog For FreeMiscellaneous3 Common Usability Mistakes In Web DesignUI/UX5 Ways to Loop Through JavaScript ArraysJavaScriptHow to create a Star Ratings using CSS?CSSHow to Use password_hash and password_verify to Secure Your User’s Data (Especially Passwords)?PHPHow to insert Bootstrap 4 in Angular 9 app?AngularWhat is Hadoop and Hadoop Ecosystem?MiscellaneousCreate dynamic selectors using SCSS (Sass)SCSS2 Ways we can create an Array in JavaScriptJavaScriptHow to remove special characters (dash, asterisk etc) from any string in PHP?PHPHow to remove the Gutenberg Block Library CSS from WordPress?WordPressHow to create a simple digital clock using JavaScript?JavaScript