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



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

Answer / 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

More jQuery Interview Questions

Differentiate between jquery.size and jquery.length? : jQuery Mobile

0 Answers  


Explain the use of the $.fn.bind and $.fn.trigger.

0 Answers  


How to create, read and delete cookies with jquery?

0 Answers  


How to programmatically trigger a click event that's being handled by jquery?

0 Answers  


What are the advantage of using cdn? : jquery mobile

0 Answers  






What are the advantages of using cdn?

0 Answers  


Can you use any other name in place of $ (dollar sign) in jQuery?

0 Answers  


How to include jQuery in ASP.Net project?

0 Answers  


How to check if number is numeric while using jquery 1.7+? : jquery mobile

0 Answers  


Difference between event.PreventDefault and event.stopPropagation?

0 Answers  


How do I check if an HTML element is empty using jQuery?

0 Answers  


What is a use of jquery filter?

0 Answers  


Categories