How do I attach load event handlers to dynamically created images?

夙愿已清 提交于 2019-12-11 18:38:00

问题


I am trying to attach a load event handler to images like this:

$(document).on('load', '.mini img', function(){
    $(this).prev().hide();
    $(this).fadeIn(500);
});

Can anyone explain why this isn't working? Images are simply formed using information gotten through an ajax request and inserted using append method. A lot of people had this problem and i wonder what the solution was.

来源:https://stackoverflow.com/questions/25168161/how-do-i-attach-load-event-handlers-to-dynamically-created-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!