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 |
Does events are also copied when you clone any element in jQuery?
Difference between find() and closest() in jquery?
Can we use our own specific character in the place of $ sign in jQuery?
How do I check if an element is hidden in jQuery?
How to select combobox select value and text using jquery?
What is the use of val() method in jquery?
Can you give me a brief history of your programming days? Where did it all start?
Explain the each() function?
How to create clone of any object using jQuery?
What are the difference between alert() and confirm()?
Is window.onload is different from document.ready()?
How to create, read and delete cookies with jquery?