我想使用jQuery將行和列插入到表中。使用jquery將空行插入到表中
當我插入一行時,來自最後一行的數據與它克隆。
如何插入沒有數據的行? 以下是jquery和fiddle。
感謝您的任何幫助。
$('#irow').click(function(){
$('#mtable tbody').append($("#mtable tbody tr:last").clone());
var rowCount = $('#mtable tr').length;
$("#rowcount").text(rowCount)
});
$('#icol').click(function(){
$('#mtable tr').append($("<td class='container'>"));
$('#mtable thead tr>td:last').html($('#col').val());
$('#mtable tbody tr').each(function() {$(this).children('td:last').append($(''))});
var col = $('#mtable tbody tr:first > td').length;
$("#colcount").text(col);
});
謝謝,我還在學習;你讓它看起來很容易。 – user1763812
幾個星期後,你會教我:-) –