jQuery click() event not firing on AJAX loaded HTML elements

前端 未结 4 1747
挽巷
挽巷 2020-12-05 00:05

the subject is pretty descriptive of my problem, I am assuming it won\'t work this way, is there a way to make it work? (workaround)?

Here is the code that is loaded

4条回答
  •  孤街浪徒
    2020-12-05 00:58

    Unless you are calling that .bind() function after that markup is loaded onto the page, you need to use another function like .live() or preferably if using a recent version of jQuery, .on() because .bind() only targets DOM elements already present when run whereas .live() and .on() give you different scope options for keeping track of elements added to the page.

提交回复
热议问题