得到这个错误:
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在jquery 1.9中被删除
见DOC:http://api.jquery.com/live/
尝试使用.on:
$(document).on('click','.formError',function(){ //your event function });