How to create clone of any object using jQuery?



How to create clone of any object using jQuery?..

Answer / chaitanya

jQuery provides clone() method which performs a deep copy of the set of matched elements, meaning that it copies the matched elements as well as all of their descendant elements and text nodes.

Hide Copy Code

$(document).ready(function(){

$('#btnClone').click(function(){

$('#dvText').clone().appendTo('body');

return false;

});

});

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More jQuery Interview Questions

How to include jQuery in ASP.Net project?

0 Answers  


Define bind() and unbind elements in jQuery?

0 Answers  


What is the use of css() method in jquery?

0 Answers  


What is jquery selectors?

0 Answers  


What is the use of jQuery.ajax method ()?

0 Answers  






How can we add change font size using jquery?

0 Answers  


What is get()? : jquery mobile

0 Answers  


Which are the fastest selectors in jquery? : jquery mobile

0 Answers  


Difference Between Prop and Attr in jQuery?

0 Answers  


Which operating system is more compatible with jQuery?

0 Answers  


Explain each() function in jquery?

0 Answers  


How do you select all elements with the class of “selected” in jquery?

0 Answers  


Categories