If you have a table, how you will apply the two differt color on alternate rows using Jquery?

<table border="1">   <tr><td>kk</td></tr>
   <tr><td>SB</td></tr>
   <tr><td>Avi</td></tr>
   <tr><td>SN</td></tr>
</table>
  Ans :
<script>

     $(document).ready(function () {
         $("tr:even").css("background-color", "#f4f4f8");
         $("tr:odd").css("background-color", "#ffffff");
     });
 </script>

No comments:

Post a Comment