jquery 取第一个TR所有TD的数据的方法

2025年03月19日 16:07
有1个网友回答
网友(1):

$("#tableid tr").each(function () {
alert($(this).find("td:first-child").text());
});

找个事件触发一下 看下效果吧 :)
--------------给错了 上面是 每个TR 第一个td的值 下面是你想要的

function cleartd() {
var text = "";
$("#tableid tr:first-child").find("td").each(function () {

text+= $(this).text();
});
alert(text);
}