如何访问表格行的单元格(JQuery)
for(i=0; i<6; i++)
{
if(document.getElementById(myData[i]).value !=0)
{
var nameInput = document.getElementById(myData[i]).name;
var Quan = document.getElementById(myData[i]).value;
//Create a new row with an ID
var newRow = $('<tr />').attr('id', 'row' + rowNumber);
//Add some HTML to the row
newRow.html('<td>' + nameInput + '</td><td>' + Quan + '</td>');
//Append the new row to the body of the #myTable table
$('#myTable tbody').append(newRow);
//Iterate row number
rowNumber++;
}
}
我正在动态创建表,并希望使用单元格的先前值添加到新表中。你能指导如何做到这一点吗?