jQuery filter() filter even element

Description

jQuery filter() filter even element

View in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").filter(":even").css("background-color", "yellow");
});/*from w  w  w . j a v a  2 s.c  o m*/
</script>
</head>
<body>

<p>(index 0).</p>
<p>(index 1).</p>
<p>(index 2).</p>
<p>(index 3).</p>
<p>(index 4).</p>
<p>(index 5).</p>

</body>
</html>



PreviousNext

Related