PhotoDune

jQuery .clone() issues

361 posts
  • Interviewed on the Envato Notes blog
  • United States
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Referred between 1000 and 1999 users
  • Exclusive Author
  • Has been a member for 3-4 years
+1 more
GoodLayers says

This is an example of codes


<div class="mom"> <div class="son"><input class="buttons" type="button" /></div> <div class="son"><input class="buttons" type="button" /></div> <div class="son"><input class="buttons" type="button" /></div> <div class="son"><input class="buttons" type="button" /></div> </div>



and this is jquery code


$(”.son”).first().clone().appendTo(”.mom”) ;
$(”.buttons”).click( function(){
// do sth here.
});


The top 4 elements work fine for .click() but last element(that appended later) seem doesn’t work…..

Any solution there??

Thanks so much :)

361 posts
  • Interviewed on the Envato Notes blog
  • United States
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Referred between 1000 and 1999 users
  • Exclusive Author
  • Has been a member for 3-4 years
+1 more
GoodLayers says

Just fixed it.
Need to use .clone(true)

by
by
by
by
by