jQuery: triggers do not fire on elements loaded with .load()

前端 未结 2 571
别跟我提以往
别跟我提以往 2021-01-21 18:55

I have index.php and use jQuery .load() to load content from load.php.

When I trigger an event on elements that are in the index.php, the event fires. On the same elemen

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 19:17

    The click event binder does not bind to any elements created after execution. You can add a click listener immediately following the .load() method, or you can use something like live or delegate to bind to element patterns in the DOM.

提交回复
热议问题