开发者

problem with clone() - events

开发者 https://www.devze.com 2023-03-05 05:58 出处:网络
i have this code: What reason the new cloned div is not associated to: $(\"#on开发者_如何学JAVAe2 .area\").change(function(){

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().
0

精彩评论

暂无评论...
验证码 换一张
取 消