如何使用jQuery向指定的表添加新行?
有没有内置的方法来做到这一点?
如何使表行可选,然后删除选定的行?
$('#yourTableId').append('new row ');
要删除单击的行,请执行以下操作:
$('tr').click(function () { $(this).remove(); });
刚刚使用此stackoverflow页面:
$('.fw').append( $(' ').append( $('').text('foo')) )
另类简写方式:
$('.fw').append( $('foo ') );
结帐http://docs.jquery.com/Manipulation了解更多信息。
var row = $('... ... '); var lastRow = $('table tr:last'); row.insertAfter(lastRow);