русский  עברית
tadam logo
דוגמאות jQuery
מצאתם שגיאה?
סמנו אותה עם העכבר ותלחצו
Ctrl + Enter
בדיקת כתיב Xhtml.co.il
Orphus system

סלקטור even

תיאור: מחפש אלמנטים זוגיים, מתחיל מ-0. ראו גם odd.

jQuery(':even')

הוספה בגרסה: 1.0

בפרט, יש לציין כי אינדקס מבוסס על 0 אומר שמונה אינטואיטיבי עם :even בוחר אלמנט ראשון, אלמנט שלישי, וכן האלה בתוך רשימה המתאימה.

דוגמאות

מחפש שורות זוגיות בטבלה, מסומנות כראשונה, שניה, רביעית וכו'. ( אינדקס 0, 2, 4 וכו' )
$("tr:even").css("background-color", "#bbbbff");
תוצאת הפעלה קוד לעיל:
קוד מלא:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>  
  <script>
  $(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>
האם מידע זה היה מועיל?
   

תגובות