Does events are also copied when you clone any element in jQuery?

Answer Posted / chaitanya

As explained in previous question, using clone() method, we can create clone of any element but the default implementation of the clone() method doesn't copy events unless you tell the clone() method to copy the events. The clone() method takes a parameter, if you pass true then it will copy the events as well.

Hide Copy Code

$(document).ready(function(){

$("#btnClone").bind('click', function(){

$('#dvClickme').clone(true).appendTo('body');

});

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Have any of your startup projects failed dismally - if so, why and how did you learn from them?

643


Is jquery still relevant 2019?

690


Where jQuery code is getting executed?

688


Change the url for a hyperlink using jquery?

637


What are the effects methods used in jquery?

596


Explain remove class jquery with example?

591


How to use connect?

626


Explain the common methods of sending a request to a server.

622


Explain the use of each function in jquery?

3976


Please tell us that is jquery knockkout intended to compete with jquery or prototype or work with it?

565


How do you check or uncheck a checkbox input or radio button?

669


Define bind() and unbind elements in jQuery?

683


Can we select a element having a specific class in jquery ?

647


What is the difference between find and children methods?

644


Tell me can we have multiple document.ready() function on the same page? : jquery mobile

611