Javascript examples for jQuery:Selector
$("tr:even") Selects all even <tr> elements
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("tr:even").css("background-color", "yellow"); });//from ww w.ja v a2 s. com </script> </head> <body> <h1>Welcome to My Web Page</h1> <table border="1"> <tr> <th>Company</th> <th>Country</th> </tr> <tr> <td>A</td> <td>Germany</td> </tr> <tr> <td>B</td> <td>Sweden</td> </tr> <tr> <td>C</td> <td>Mexico</td> </tr> <tr> <td>D</td> <td>Austria</td> </tr> <tr> <td>E</td> <td>UK</td> </tr> </table> </body> </html>