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
Configuring Modules with @forward rule in SCSS (Sass)SCSSSome EASY-to-Understand CSS media query examplesCSSDid you get an error while displaying Special Characters in JavaScript?JavaScriptWhat is Etrieve Flow?MiscellaneousHow to make WordPress main stylesheet (style.css)?WordPressHow to Use ROLLUP Operator in SQL and MySQL?SQL/MySQLPre-defined DatePipe format options in Angular 9AngularWhat’s the difference between a Framework and a Library?MiscellaneousSQL Inner JoinSQL/MySQLHow to Access a Global Variable From Inside a Function in PHP?PHPHow to Use the EXISTS and NOT EXISTS Operator with a Subquery in SQL and MySQL?SQL/MySQLHow to use a Subquery to Insert Multiple Rows in SQL Table?SQL/MySQL