Saturday, 24 August 2013

Previous Interview Question Next Interview Question
Home

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

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.
$(document).ready(function(){
   $("#btnClone").bind('click', function(){
     $('#dvClickme').clone(true).appendTo('body');
  });

Previous Interview Question Next Interview Question
Home

0 comments :

Post a Comment