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 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
5 Steps to Create a Line using Canvas Tag in HTML5HTMLLearn to make a responsive gallery using CSS Grid and without media queriesCSSArray destructuring and Object destructuring in JavaScriptJavaScriptEverything you need to know about ANY, SOME and ALL Operators in PostgresPostgresHow to detect the Blog Page in WordPress?WordPressHow to Pop an Alert Box in PHP?JavaScriptHow to update or disable WordPress Post Revisions?WordPressHTML canvas methodsHTMLDebugging in WordPress Part 1: WP_DEBUGWordPressA short basic guide on states in ReactReactHow to use HTML picture Tag?HTMLHow to use @each rule with key-value pair in SCSS?SCSS