How can I add a new row to the specified table using jQuery?
Is there a built-in method for doing this?
And how to make the table rows selectable and then delete the selected row?
+1
omg
source
to share
3 answers
$('#yourTableId').append('<tr><td>new row</td></tr>');
To remove the selected row, follow these steps:
$('tr').click(function () {
$(this).remove();
});
+10
RaYell
source
to share
Just did it using this stackoverflow page:
$('.fw').append(
$('<tr/>').append( $('<td>').text('foo'))
)
Alternative shortcut:
$('.fw').append( $('<tr><td>foo</td></tr>') );
Checkout http://docs.jquery.com/Manipulation for more.
+1
meder omuraliev
source
to share
var row = $('<tr><td>...</td><td>...</td></tr>');
var lastRow = $('table tr:last');
row.insertAfter(lastRow);
0
John Fisher
source
to share