jQuery doesn't work after content is loaded via AJAX

后端 未结 9 1111
野的像风
野的像风 2020-11-22 15:21

On this page I have a jQuery popup window and thumbnail resizable images. If I mouse over on the thumbnails, the images are resizing perfectly. Also, when I click on the big

9条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 16:01

    You Can User jQuery's delegate() method which Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.In my case it's working as expected

    this $(selector).click(function(e){}

    become this after Using delegate() method

    $( "body" ).delegate( "selector", "click", function(e) {}

    Hope this will help ;)

提交回复
热议问题