What is the best method in jQuery to add an additional row to a table as the last row?
Is this acceptable?
$(\'#myTable\').append(\'
-
So things have changed ever since @Luke Bennett answered this question. Here is an update.
jQuery since version 1.4(?) automatically detects if the element you are trying to insert (using any of the append(), prepend(), before(), or after() methods) is a and inserts it into the first in your table or wraps it into a new if one doesn't exist.
So yes your example code is acceptable and will work fine with jQuery 1.4+. ;)
$('#myTable').append('my data more data ');
- 热议问题