Is there a quick way to clone a <tr>
element without its content in cells? Basically to have a pure <tr>
element having only the same structure as the original?
Is there a quick way to clone a <tr>
element without its content in cells? Basically to have a pure <tr>
element having only the same structure as the original?
- Do you mean a deep clone or a shallow one? – Frédéric Hamidi Commented Jun 1, 2011 at 8:41
- By deep clone, you mean all the child elements within table cells? – pencilCake Commented Jun 1, 2011 at 8:43
1 Answer
Reset to default 12If you want a deep clone of the element without the text content, you can write something like:
var $cloned = $("tr").clone().children().text("").end();