获取“当前"行中的所有行.表,而不是来自子表 [英] Get all rows in the "current" table, and not from child tables
本文介绍了获取“当前"行中的所有行.表,而不是来自子表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不获取子表中的行的情况下获取表中的所有行?
How can you get all rows in a table without getting the rows in child tables?
var rows = $('tr', tbl);
这将返回所有<tr>
标记,包括子表中的所有行.
This will return ALL <tr>
tags, including all rows in child tables.
推荐答案
var rows = $('#tblID > tbody > tr')
子选择器将获得表的<tbody>
元素,并因此获得
The child selector will get the table's <tbody>
element and consequently get the <tr>
elements that are direct children of the table's tbody.
如果您已经有一个表对象:
If you already have a table object:
var rows = $(tbl).find('> tbody > tr');
或者:
var rows = $(tbl).children('tbody').children('tr');
这篇关于获取“当前"行中的所有行.表,而不是来自子表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文