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

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?

0 Answers  


Which one is more efficient, document.getelementbyid( "idname") or $("#idname)?

0 Answers  


How to select combobox select value and text using jquery?

0 Answers  


What is the difference between .js and .min.js?

1 Answers  


What is chaining in jQuery?

1 Answers  


Can you write a code to select all links inside the paragraph?

0 Answers  


Mention the advantages of cdn? : jQuery Mobile

0 Answers  


Can you please explain the difference between body onload() and document.ready() function? : jquery mobile

0 Answers  


How we can modify the css class in jquery?

0 Answers  


What is cdn and how jquery is related to it?

0 Answers  


Explain .siblings() method in jquery?

0 Answers  


What are the features of jQuery, has been used in web applications?

0 Answers  


Categories