I'm trying to add a row to a table with jquery. I would like to add the row in first position, but not the very first, I want it to come after the row dedicated to the column headers 'th'. If I try
$('#tableid').prepend()
obviously the new row comes before the one of 'th's. Any idea of how to do that?
Assuming your first tr
that holds the th
you could do:
$('#tableid tr:first').after(newTrContent);
Or you if have them separated out into thead and tbody then you could just do.
$('#tableid tbody').prepend(newTrContent);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.