YogeshChauhan . com

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 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

Learn to Implement Estimated Reading Time using PHP Part 2: Final Implementation with Source CodePHPSQL ALL OperatorSQL/MySQLCrypto.getRandomValues() method in JavaScriptJavaScriptHow destructuring works in React?ReactWhat is iFrame in HTML? Why do we need it?HTMLLearn how to give a temporary name to a column or to a table using SQL AliasesSQL/MySQLHow to load a module with configuration in SCSS?SCSSComposing and Extracting Components in ReactReactFive common features of Angular template syntax (with examples)AngularHow to host Google fonts on your server and add them using CSS?CSSHTML canvas methodsHTMLContent types in DrupalDrupal