简体   繁体   中英

How to clone a <tr> element without data but only the structure by using jQuery?

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?

If you want a deep clone of the element without the text content, you can write something like:

var $cloned = $("tr").clone().children().text("").end();

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM