jQuery not() by even

Description

jQuery not() by even

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").not(":even").css("background-color", "yellow");
});/* w  w  w.  jav  a  2  s .  co  m*/
</script>
</head>
<body>

<p>This is a test (index 0).</p>
<p>I am from java2s.com (index 1).</p>
<p>This is another test (index 2).</p>
<p>CSS HTML (index 3).</p>
<p>I am from java2s.com (index 4).</p>
<p>Javascript (index 5).</p>

</body>
</html>



PreviousNext

Related