How to use Jquery [removed]() on elements that are pulled in via Ajax?

前端 未结 1 1594
遇见更好的自我
遇见更好的自我 2020-12-09 11:27

I have a Jquery Mobile shell page, which I\'m loading a form into using Ajax. The form has some checkboxes, which I need to bind to.

Oddly, I can get it to work set

相关标签:
1条回答
  • 2020-12-09 12:04

    The way the .on() method works changes according to how you use it. In your first example the .on() method behaves similar to bind and will only work on elements that already exist.

    The second example behaves like .live() or delegate() in many ways. And will work for elements that are added later.

    Read the docs for a detailed explanation http://api.jquery.com/on/

    0 讨论(0)
提交回复
热议问题