JQuery's simplicity is so wonderful and powerful. Here's a perfect example. If you have a table, and you want to alternate the row colors. To do so, all you need is this:
$(document).ready(function() {
$("table.striped tr:nth-child(even)").addClass("altrow");
});
Then, just add class="striped" to your table tag, and jquery will automatically apply add the class "altrow" to every other row. (If you want to change which row it starts with – change 'even' to 'odd' in the code above).
Then just include a style for your altrow:
table.striped tr.altrow td {
background-color: #ccc;
}
And to think I used to do that manually. OY!