jquery-隔行换色(三)

html:

    <table class="b">
      <thead>
        <tr>
          <th>姓名</th>
          <th>年龄</th>
          <th>性别</th>
        </tr>
        <tr>
          <td>我</td>
          <td>11</td>
          <td>男</td>
        </tr>
        <tr>
          <td>你</td>
          <td>12</td>
          <td>女</td>
        </tr>
        <tr>
          <td>他</td>
          <td>13</td>
          <td>男</td>
        </tr>
      </thead>
    </table>

js:

    <script>
      $('tr:odd').css({ background: 'red' })
    </script>

效果:

猜你喜欢

转载自blog.csdn.net/weixin_43595461/article/details/90708282