如何创建包含所有表单元素的表单副本,以便可以对副本进行操作,同时保持原始表单不变?
最佳答案
像这样使用普通的 javascript cloneNode
var dupNode = node.cloneNode(deep);
例子
var p = document.getElementById("para1"), var p_prime = p.cloneNode(deep); //If "deep" is set to true it will clone all the child nodes too, //If set to false then only the node and not the children
这是 documentation .
希望对您有所帮助。
关于javascript - 如何使用 DOM 元素创建表单的副本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18196541/