How to add a <tbody> to a specified <table > with jQuery?
-
07-07-2019 - |
Question
I want to add the tbody below:
<tbody id="contact">
...
</tbody>
to a specified table:
<table id="target">
...
</table>
Solution
Ripped off the jQuery docs, you can use
$("p").append("<strong>Hello</strong>");
So in your case it'll be
$('#target').append("<tbody id=\"contact\">...</tbody>");
OTHER TIPS
Here's a better way :
$("#your_table_id > tbody ").append(yourhtml);
var tbody = "<tbody id='contact' />";
$("#target").append(tbody);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow