

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How does jQuery.eq() method work in jQuery?
If you want to return an element with a definite index number of the selected elements, then use the eq() method. The first element has index 0, the second element has index 1, etc. Yes, the index number starts at 0.
Example
You can try to run the following code to learn how to work with jQuery.eq() method,
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").eq(3).css("background-color", "gray"); }); </script> </head> <body> <h1>Tutorialspoint</h1> <p>Free Learning</p> <p>Free Text Tutorials</p> <p>Free Video Tutorials</p> <p>Tutor Connect</p> </body> </html>
- Related Questions & Answers
- jQuery eq() method
- How does jQuery replaceWith() method work?
- How does jQuery.filter() method work in jQuery?
- How does jQuery.find() method work in jQuery?
- How does jQuery.map() method work in jQuery?
- How does jQuery.slice() method work in jQuery?
- How does jQuery.nextAll() method work in jQuery?
- How does jQuery.clone() method work in jQuery?
- How does jQuery.add( ) work in jQuery?
- How does $('iframe').ready() method work in jQuery?
- How does CSS Selectors work in jQuery?
- How does jQuery Datepicker onchange event work?
- How do we use jQuery selector eq:()?
- How to work with jQuery.closest() method in jQuery?
- What does html() method do in jQuery?
Advertisements