Alternating table row color, but with 2 rows of data

Posted by PixelMuse on Stack Overflow See other posts from Stack Overflow or by PixelMuse
Published on 2012-03-20T20:39:28Z Indexed on 2012/03/20 23:29 UTC
Read the original article Hit count: 151

Filed under:

I've got my table setup for Zebra striping, but how do I accomplish making the row color alternate for 2 rows instead of a single row?

My data markup looks like this:

<tr>
        <td>@task.TaskNum</td>
            <td>@task.RepiarTime</td>
            <td>Priority Club</td>
            <td>SD</td>
            <td>Commercial</td>
            <td>Reg Commercial</td>
            <td>After Hours</td>
        </tr>
        <tr><td colspan="7">
                @task.Description.ToString()
            </td></tr>

I am using this to stripe it:

    $(document).ready(function () {
    $(".stripeMe tr").mouseover(function () { $(this).addClass("over"); }).mouseout(function () { $(this).removeClass("over"); });
    $(".stripeMe tr:even").addClass("alt");
});

© Stack Overflow or respective owner

Related posts about jQuery