|
jQuery - JavaScript Sorting |
|
Page 2 of 2
Row Grouping Tags
Note our use of the
and
|
tags to segment the data into row groupings. Many HTML authors omit these implied tags, but they can prove useful in supplying us with more convenient CSS selectors to use. For example, suppose we wish to apply typical even/odd row striping to this table, but only to the body of the table:
$(document).ready(function() {
$('table.sortable tbody tr:odd').addClass('odd');
$('table.sortable tbody tr:even').addClass('even');
});
%24%28document%29.ready%28function%28%29%20%7B%0A%0D%0A%24%28%27table.sortable%20tbody%20tr%3Aodd%27%29.addClass%28%27odd%27%29%3B%0A%0D%0A%24%28%27table.sortable%20tbody%20tr%3Aeven%27%29.addClass%28%27even%27%29%3B%0A%0D%0A%7D%29%3B
This will add alternating colors to the table, but leave the header untouched:

Trackback(0)
