Wil*_*son 2 javascript jquery html-table tablerow
var Rows = $("#tableid tbody tr");
Rows.each(function(index, element) {
var thirdCell = $(this+":nth-child(3)").text();
alert(thirdCell);
});
Run Code Online (Sandbox Code Playgroud)
行中的某些var thirdCell内容无法正常工作.每行有四个孩子,都是td标签.我想在第三个单元格中获取文本.
尝试类似下面的内容,
var Rows = $("#tableid tbody tr");
Rows.each(function(index, element) {
var thirdCell = $(this).find('td').eq(2).text();
alert(thirdCell);
});
Run Code Online (Sandbox Code Playgroud)