且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JQuery .on() 没有将点击事件绑定到动态创建的元素

更新时间:2022-06-22 02:16:22

这是错误的:$('.icon.remove').on('click'...

这是对的:$(document).on('click', '.icon.remove', function)

您可以使用任何容器代替文档(这是***别的容器).

you can use any container instead of document (which is the most highlevel container).

希望对你有帮助