סלקטור odd
תיאור: מחפש אלמנטים אי זוגיים, מתחיל מ-0. ראו גם even.
jQuery(':odd')
הוספה בגרסה: 1.0
בפרט, יש לציין כי
אינדקס מבוסס על 0
אומר שמונה אינטואיטיבי עם
:odd
בוחר אלמנט שני, אלמנט רביעי, וכן האלה בתוך רשימה המתאימה.
דוגמאות
מחפש שורות של טבלה אי זוגיות, מסומנות כשניה, רביעית וכו' ( אינדרס 1, 3, 5 וכו' ).קוד מלא:
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $("tr:odd").css("background-color", "#bbbbff"); }); </script> <style> table { background:#f3f7f5; } </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>
האם מידע זה היה מועיל?

