jQuery clone () method
Examples
All clone <p> element, and inserted into the <body> element at the end:
$("button").click(function(){
$("p").clone().appendTo("body");
});
$("p").clone().appendTo("body");
});
try it"
Definition and Usage
clone () method to generate a copy of the selected elements, including child nodes, and text attributes.
grammar
$(selector).clone(true|false)
参数 | 描述 |
---|---|
true | 规定需复制事件处理程序。 |
false | 默认。规定不复制事件处理程序。 |
More examples
Copy the element that contains the event handler
How to use the clone () method to copy an element that contains the event handler.