Selecteurs: ":even"

Selectionne les éléments pairs (index à partir de 0).

Version: disponible depuis la version 1.0 de JQuery

Valeur de retour: tableau d'éléments

Exemple :
$("tr:even").css("background-color", "#bbbbff");
  <html>
  <head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  <script type="text/javascript">
  	$(document).ready(function(){
  		$("tr:even").css("background-color", "#bbbbff");

  	});
  </script>
  
  <style>
  
  table {
    background:#eeeeee;
  }
  
  </style>
  </head>
  <body>
  	
  <table border="1">
    <tr><td>Row with Index #0</td></tr>
    <tr><td>Row with Index #1</td></tr>
    <tr><td>Row with Index #2</td></tr>
    <tr><td>Row with Index #3</td></tr>
  </table>
  </body>
  </html>

0 Commentaire (afficher/poster)