problem with clone() - events
i have this code:
What reason the new cloned div is not associated to:
$("#on开发者_如何学JAVAe2 .area").change(function(){
alert('changedTwo');
});
i dynamically generate a new id. The first cloned object is: div id="one2"
How i can fix that? thanks!
It might be that the element didn't exist when the event-handlers were bound, on document ready. To test, you could change to:
$("#one2 .area").live('change', function(){
alert('changedTwo');
});
Reference:
live()
.
精彩评论