I want to set the alternate background color for rows in a table – but the twist is that I don’t want every other row to be colored, I want to treat them in blocks of three rows.
So for a table with eight rows I want the first three to be white, then the next three to have a background color, and the last two are back to white again.
How can I do this using jQuery?
You could
.filter()your result set based on the index of the result:jsfiddle demo