选择表中除表头行之外的行 [英] select rows in a table except the table header rows

查看:64
本文介绍了选择表中除表头行之外的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用jquery在html表中选择表头行以外的行?

How to select rows in a html table except the table header rows using jquery?

 <table id="mytable">
        <thead>
            <tr>
                <th>
                    Foo
                </th>
                <td>
                    Lorem
                </td>
                <td>
                    Ipsum
                </td>
            </tr>
        </thead>
        <tr>
            <th>
                Bar
            </th>
            <td>
                Dolor
            </td>
            <td>
                Sit
            </td>
        </tr>
        <tr>
            <th>
                Baz
            </th>
            <td>
                Amet
            </td>
            <td>
                Consectetuer
            </td>
        </tr>
    </table>

推荐答案

$('tr').not('thead tr').addClass('selected')

这篇关于选择表中除表头行之外的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆