-->

jQuery :even Selector

By: Bipin C Mathew 9 months ago

Even is the simple mathematical term, An Even number is an integer which is multiple of two. The :even selector selects an odd index like 1, 3, 5, 7.. etc for each table row. The Even Selector selects the first element, third element, and so on . The even selector is an extension of jQuery and not part of the CSS specification.

Syntax  $(":even")

Example

<!doctype html>
	<html lang="en">
	<head>
	  <meta charset="utf-8">
	  <title>odd demo</title>
	  <style>
	  table {
	    background: #e3f7f5;
	  }
	  </style>
	  <script src="https://code.jquery.com/jquery-3.4.1.js"></script>
	</head>
	<body>
	 
	<table border="1">
	  <tr><td>The Row 0</td></tr>
	  <tr><td>The Row 1</td></tr>
	  <tr><td>The Row 2</td></tr>
	  <tr><td>The Row 3</td></tr>
	</table>
	 
	<script>
	$( "tr:even" ).css( "background-color", "#febbff" );
	</script>
	 
	</body>
	</html>

Comments

Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.