[英]jQuery Get All First Cells Of Table
我需要获取某个表中所有行的所有tds(单元格),是否有一种优雅的方法来执行此操作,或者我需要以某种方式自己遍历集合?
try first-child
尝试
first-child
$('table tr td:first-child')
or
$("table tr td:first")
or
$("table tr td").first()
此代码将返回表中所有id为tableId的tds
$('#tableId td')
Your question title is different from your question body. 您的问题标题与问题正文不同。 You may be interested in this solution, although I can't be sure:
您可能对此解决方案感兴趣,尽管我不确定:
$('#table_id tr td:first-child')
You have to loop it 你必须循环
Try this 尝试这个
$('#mytable tr').each(function() {
var customerId = $(this).find("td:first").html();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.