Saturday, November 1, 2014

Odd and even table row classes in jquery

In this example how to set  aleternate even and odd rows using jquery
<style type="text/css">
       
.odd
        {
            background-color#EFF3FB;
        }
        .even
        {
            background-color#fff;
        }
    </style>
<script type="text/javascript">
        $(function () {
            $("#rptDetails > tbody > tr:odd").addClass("odd");
            $("#rptDetails > tbody > tr:not(.odd)").addClass("even");
        });
   
    </script>

<table id="rptdetails">
        <tr>
            <td>anil</td>
            <td> 30</td>
            <td>address1</td>
        </tr>
          <tr>
            <td>sd</td>
            <td> 30</td>
            <td>address1</td>
        </tr>
          <tr>
            <td>asnil</td>
            <td> 30</td>
            <td>address3</td>
        </tr>
          <tr>
            <td>sds</td>
            <td> 30</td>
            <td>sds</td>
        </tr>

    </table>

No comments:

Post a Comment

http://blogsiteslist.com