Javascript examples for jQuery Method and Property:clone
Copy the first p element including event handlers, and append to body element
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("body").append($("p:first").clone(true)); });/*from ww w . ja va 2 s .c o m*/ $("p").click(function(){ $(this).animate({fontSize: "+=1px"}); }); }); </script> </head> <body> <p>Click this paragraph to increase text size.</p> <p>This is another paragraph.</p> <button>Test</button> </body> </html>