且构网

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

jQuery插件不适用于Ajax加载的内容

更新时间:2023-12-05 08:29:58

像Kevin说的,你需要在加载新元素后初始化插件。一个简单的方法是注册一个处理程序,为所有的ajax请求调用。

Like Kevin said you need to initialize the plugin on the new elements after you load them. An easy way to do this globally is register a handler to be called for all ajax requests.

 $(document).ajaxComplete(function(event, xhr, settings) {
     $('.myForm').thePlugin();
 }