How to create clone of any object using jQuery?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how jquery works?

511


What does $("P") will select?

502


Explain the concepts of "$ function" in jquery with an example?

520


What is the slowest selector in jQuery?

657


What is the difference between $(this) and 'this' in jquery?

6079






Explain which program is useful for testing jquery?

8680


Tell me how to executed jquery selectors? : jquery mobile

455


Explain type paremeter of jquery ajax method?

442


Can you give me a brief history of your programming days? Where did it all start?

591


Explain bind() vs live() vs delegate() methods.

477


Why html 5 inputs look different across devices and browsers? : jquery mobile

419


Can JQuery Run on MAC or Linux instead of Windows?

480


How we can hide a block of html code on a button click using jquery?

481


What is the difference between the knockout and jquery?

440


What is jquery selectors? Give some examples.

461