eq

abbr.

equation balance; equipment equipment; equalization equalization; equate equalization

jquery eq() selector syntax

Function: :eq() selector selects elements with the specified index value. Index values ​​start at 0, and all first elements have an index value of 0 (not 1). Often used in conjunction with other elements/selectors to select elements with a specific sequence number in a specified group (as in the example above).

Syntax: $(":eq(index)"

Parameters: index Required. Specifies the index value of the element.

jquery eq() selector example

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript"> 
 
$(document).ready(function(){
    $("p:eq(1)").css("background-color","#B2E0FF");
});
</script>	
</head>
<body>
<html>
<body>
<h1>Welcome to My Homepage</h1>
<p class="intro">My name is Donald</p>
<p>I live in Duckburg</p>
<p>My best friend is Mickey</p>
<div id="choose">
Who is your favourite:
<ul>
<li>Goofy</li>
<li>Mickey</li>
<li>Pluto</li>
</ul>
</div>
</body>
</html>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance