Select and hide all odd table rows. - Javascript jQuery

Javascript examples for jQuery:Table

Description

Select and hide all odd table rows.

Demo Code

ResultView the demo in separate window

<!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:odd").hide();
});/*w  ww.  j a v  a  2  s  .com*/
</script>
</head>
<body>

<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>

Related Tutorials