The :odd selector selects elements with an odd index number.
The index numbers start at 0.
$(":odd")
Select every other (odd) <tr> element:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("tr:odd").css("background-color", "yellow"); });//from w w w . j a va2 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>CSS</td> <td>Germany</td> </tr> <tr> <td>A</td> <td>Sweden</td> </tr> <tr> <td>Javascript</td> <td>Mexico</td> </tr> <tr> <td>C++</td> <td>XYZ</td> </tr> <tr> <td>Ruby</td> <td>UK</td> </tr> </table> </body> </html>