Code:
<html lang="en"> <head> <title>JQueryexamplecode.blogspot.com</title> <script src="js/jquery.js" type="text/javascript"></script> <style type="text/css"> .table, .table tr, .table td{ border: 1px red solid; } .ChangeColor {background-color:yellow;} </style> </head> <body> <div class="divison"> <p> first para</p> <p> second para</p> <P> third para</p> <p> fourth para</p> </div> <table class="table"> <tr><td>First row</td></tr> <tr><td>Second row</td></tr> <tr><td>Third row</td></tr> <tr><td>Fourth row</td></tr> </table> <script> $('.table tr:even').addClass('ChangeColor'); $('.divison p:even').addClass('ChangeColor'); </script> </body> </html>
Output:
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.