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.

Syntax


.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 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

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
Window setInterval() Method in JavaScriptJavaScriptHow to include CSS and JavaScript files in your WordPress plugin?WordPressHow to get front page or home page ID in WordPress?WordPressHow to create a new HTML element programmatically using JavaScript?HTMLHow to force your website to load securely with an .htaccess file?MiscellaneousHow to import MySQL small sample database into phpMySQL?SQL/MySQLSlider animation using CSS transform propertyCSSLIKE and ILIKE Operators in PostgresPostgresRevisiting variable scope in JavaScriptJavaScriptForcing the domain to serve securely using HTTPSMiscellaneousWhy does MOV matter in IT or any kind of projects?MiscellaneousMiddleware in NextJSNextJS