tr even Selects all even rows of table - jQuery
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <title>tr even Selects all even rows of table - jQuery Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $("#demo").click(function(){ $("#myTable > tbody > tr:even").css("background","yellow"); }); }); </script> </head> <body> <a href="javascript:void(0)" id="demo"> Click Me To Select Even Rows </a><br><br> <table id='myTable'> <tbody> <tr><td>Jhohn</td><td>jhone@gmail.com</td><td>USA</td></tr> <tr><td>Kelly</td><td>kelly@gmail.com</td><td>USA</td></tr> <tr><td>Kamana</td><td>kamna@gmail.com</td><td>India</td></tr> <tr><td>Anay</td><td>anay@gmail.com</td><td>Canada</td></tr> <tr><td>AnaMy</td><td>amy@gmail.com</td><td>Canada</td></tr> <tr><td>Rummy</td><td>asd@gmail.com</td><td>Canada</td></tr> <tr><td>Jelly</td><td>y@gmail.com</td><td>Canada</td></tr> </tbody> </table> </body> </html>
<!DOCTYPE html> <html> <head> <title>tr even Selects all even rows of table - jQuery Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $("#demo").click(function(){ $("#myTable > tbody > tr:even").css("background","yellow"); }); }); </script> </head> <body> <a href="javascript:void(0)" id="demo"> Click Me To Select Even Rows </a><br><br> <table id='myTable'> <tbody> <tr><td>Jhohn</td><td>jhone@gmail.com</td><td>USA</td></tr> <tr><td>Kelly</td><td>kelly@gmail.com</td><td>USA</td></tr> <tr><td>Kamana</td><td>kamna@gmail.com</td><td>India</td></tr> <tr><td>Anay</td><td>anay@gmail.com</td><td>Canada</td></tr> <tr><td>AnaMy</td><td>amy@gmail.com</td><td>Canada</td></tr> <tr><td>Rummy</td><td>asd@gmail.com</td><td>Canada</td></tr> <tr><td>Jelly</td><td>y@gmail.com</td><td>Canada</td></tr> </tbody> </table> </body> </html>
Copyrights@tutorialsplane.com