[英]jQuery Get All First Cells Of Table
我需要獲取某個表中所有行的所有tds(單元格),是否有一種優雅的方法來執行此操作,或者我需要以某種方式自己遍歷集合?
嘗試first-child
$('table tr td:first-child')
or
$("table tr td:first")
or
$("table tr td").first()
此代碼將返回表中所有id為tableId的tds
$('#tableId td')
您的問題標題與問題正文不同。 您可能對此解決方案感興趣,盡管我不確定:
$('#table_id tr td:first-child')
你必須循環
嘗試這個
$('#mytable tr').each(function() {
var customerId = $(this).find("td:first").html();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.