开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜