我需要获取某个表中所有行的所有 tds(单元格),是否有一种优雅的方法可以做到这一点,或者我是否需要以某种方式自己遍历集合?
问问题
88 次
4 回答
1
尝试first-child
$('table tr td:first-child')
or
$("table tr td:first")
or
$("table tr td").first()
于 2012-11-06T07:14:30.903 回答
0
此代码将返回您的表中的所有 tds,id=tableId
$('#tableId td')
于 2012-11-06T07:12:58.833 回答
0
您的问题标题与您的问题正文不同。您可能对此解决方案感兴趣,但我不能确定:
$('#table_id tr td:first-child')
于 2012-11-06T07:14:19.160 回答
0
你必须循环它
试试这个
$('#mytable tr').each(function() {
var customerId = $(this).find("td:first").html();
});
于 2012-11-06T07:14:56.007 回答