I am currently using the .load() function to load content into a container div dynamically. The content being loaded is table data which I'd like to zebra stripe. The zebra striping is easy on a static page, but I can't figure out how to zebra stripe the new content loaded into the container div.
Here's the code with which I'm trying to work:
$("table tbody tr:even").live("EVENT", function(){
$(this).addClass("alt");
});
The "EVENT" shouldn't be "click", or "mouseover" but "onload" or something to that effect. Is there a way to do this? Thanks for your suggestions!
~Jared
You should just run the zebra striping code in the callback function for the load().
$("#myDiv").load( "/somecontroller/someaction", { data: value }, function() {
$("#myDiv").find( "table tbody tr:even" ).addClass( "alt" );
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With