I am using jQuery 1.6 and I would like to improve the following code (that is, write less do more):
if (row.hasClass('line_odd')) {
row.removeClass('line_odd');
row.addClass('line_even');
} else {
row.removeClass('line_even');
row.addClass('line_odd');
}
How can I do that?
Assuming row starts with exactly one of the two classes:
should do the trick.