I have a string returned from an ajax call like this
<table>
<tbody>
<tr>
<td>Name</td>
<td>Age</td>
</tr>
<tr>
<td>Ron</td>
<td>28</td>
</tr>
</tbody>
</table>
Now I want to rebuild it on
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr></thead>
<tbody>
<tr>
<td>Ron</td>
<td>28</td>
</tr>
</tbody>
</table>
How to do it in jQuery?
The line below inserts aad and copies the first tr into it
$(data.d).prepend("<thead></thead>").find("thead").html($(data.d).find("tr:eq(0)"))
I am trying to delete the first line in tbody after the previous line using this line
$(data.d).find("tbody tr:eq(0)").remove()
How to add thead, move, first trto tbodyhim, to replace all tdinside this on th, and finally, to remove the first troftbody
source
share