Reputation: 55
I have this element
<tr class="group-row">
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
I want to clone it and add <tbody>
parent to it to be like this
<tbody>
<tr class="group-row">
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</tbody>
Upvotes: 1
Views: 192
Reputation: 51
something like this should work :
var $clone = $("#element-to-clone").clone();
$("#where-you-want-to-put-the-clone").append($clone);
$clone.wrap( "<tbody></tbody>" );
Upvotes: 2