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

What are source maps in jQuery?

1 Answers  


What is jquery selectors? Give some examples.

1 Answers  


How can you use a jquery library in your project?

1 Answers  


What are different type of selector in jQuery?

1 Answers   Wipro,


Suppose if you have a server control(asp.net server control, button) and on the click of button you want to call a jquery function, so tell me how you will call a jquery function without postback?

1 Answers  


Can we use jQuery to make ajax request?

2 Answers  


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

1 Answers  


Difference Between Prop and Attr in jQuery?

1 Answers  


Which is the starting point of code execution in jQuery?

1 Answers  


What are the advantages of minified version of jquery?

1 Answers  


What is jQuery?

1 Answers  


Differentiate between width() vs css(‘width’) in jquery

1 Answers  


Categories