What is the best method in jQuery to add an additional row to a table as the last row?
Is this acceptable?
$(\'#myTable\').append(\'
-
$('#myTable').append('my data more data ');
will add a new row to the first TBODY of the table, without depending of any THEAD or TFOOT present.
(I didn't find information from which version of jQuery .append() this behavior is present.)
You may try it in these examples:
h1 h2
1 2
f1 f2
h1 h2
1 2
3 4
f1 f2
h1 h2
1 2
In which example a b row is inserted after 1 2, not after 3 4 in second example. If the table were empty, jQuery creates TBODY for a new row.
- 热议问题