I've got a table design I'm using across multiple tables. There will be some color differences, but they are determined based on classes. ex:
<table id="table" class="table1"> and <table id="table" class="table2">
I want to apply javascript striping to odd rows; however, want it to work on all tables with ID table
because on some pages there will be multiple tables with the same ID (just different classes).
I've looked at this code,
$(document).ready(function(){
$("#table tr:odd").addClass("odd");
});
But it appears to only work on the first table and stops after that. I saw a code the other day that worked; however, now I can't seem to find it. Any suggestions on a javascript code that will work across multiple tables, getting the odd rows from each table separately and applying the class to those rows?
If I didn't phrase this correctly, please let me know and I will try to correct. And I'm not using CSS nth-child to do this because the CSS nth-child doesn't work in IE (at least I havent been able to get it to work). I need this site to work even in older browsers, which is why I'm going back to JS. I also need the JS to work in all browsers.