What is the best method in jQuery to add an additional row to a table as the last row?
Is this acceptable?
$(\'#myTable\').append(\'
-
I recommend
$('#myTable > tbody:first').append('... ... ');
as opposed to
$('#myTable > tbody:last').append('... ... ');
The first
and last
keywords work on the first or last tag to be started, not closed. Therefore, this plays nicer with nested tables, if you don't want the nested table to be changed, but instead add to the overall table. At least, this is what I found.
- 热议问题