Is it possible to get jQuery to do the same job as nth:child(odd)?
So that I can add zebra lines to tables in browsers like IE6?
If so can someone help?
Is it possible to get jQuery to do the same job as nth:child(odd)?
So that I can add zebra lines to tables in browsers like IE6?
If so can someone help?
You are using the wrong syntax: $(":nth-child(odd)")
or shorter $(":odd")
You can use the :odd
selector to select odd table rows, like so:
$("tr:odd").css("background-color", "#DDD");
Just do ("table tr:odd") or ("table tr:even"). Try using http://api.jquery.com where most of these types of questions are answered.