收到此错误:
Uncaught TypeError: Object [object Object] has no method 'live'
来自此 JavaScript 和 jQuery 代码:
init: function(options) {
var form = this;
if (!form.data('jqv') || form.data('jqv') == null ) {
options = methods._saveOptions(form, options);
// bind all formError elements to close on click
$(".formError").live("click", function() {
//Getting error here:
//Uncaught TypeError: Object [object Object] has no method 'live'
});
}
return this;
};
为什么缺少方法live
?
最佳答案
.live
在 jquery 1.9 中被删除
请参阅文档:http://api.jquery.com/live/
<小时/>尝试使用 .on
代替:
$(document).on('click', '.formError', function(){
//your event function
});
关于jquery - 未捕获的类型错误 : Object [object Object] has no method 'live' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16218120/