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 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #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

#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 #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
A Step by Step Guide to Make RSS in XML For Any Website or Blog For FreeMiscellaneousIs there a CSS parent selector?CSSHow to add before after image effect using pure CSS?CSSHere’s what we can do with PHP date() functionPHPWhat Is a Graph Database?Miscellaneous10 Usability Blunders to AvoidUI/UXHow to create a dynamic countdown using HTML and JavaScript?HTMLSolution for Xcode 11 Command PhaseScriptExecution failed with a nonzero exit code errorMiscellaneousJavaScript Number MethodsJavaScriptHigher Order Functions in JavaScript with ExamplesJavaScriptWhat is a Strict Requirement in PHP 7 Function Declarations?PHPFlash of Invisible Text and Mitt Romney Web Font ProblemCSS