Jquery查找(…)。live不是函数
我最近将jquery库更新为3.3.1,此后jquery.fileupload-ui在此中断Jquery查找(…)。live不是函数,jquery,jquery-file-upload,Jquery,Jquery File Upload,我最近将jquery库更新为3.3.1,此后jquery.fileupload-ui在此中断 _initEventHandlers: function () { $.blueimp.fileupload.prototype._initEventHandlers.call(this); var filesList = this.element.find('.files'), eventData = { fileupload: this };
_initEventHandlers: function () {
$.blueimp.fileupload.prototype._initEventHandlers.call(this);
var filesList = this.element.find('.files'),
eventData = { fileupload: this };
filesList.find('.start a')
.live(
'click.' + this.options.namespace,
eventData,
this._startHandler
);
filesList.find('.cancel a')
.live(
'click.' + this.options.namespace,
eventData,
this._cancelHandler
);
filesList.find('.delete a')
.live(
'click.' + this.options.namespace,
eventData,
this._deleteHandler
);
},
我的感觉是live
不受欢迎
如何修改此代码以解决此问题
亲切问候您的感觉是正确的,
live()
很久以前就被弃用了,现在已经被删除了
现代方法是使用on()
方法的委托签名。根据您的代码,它将如下所示:
\u initEventHandlers:function(){
$.blueimp.fileupload.prototype.\u initEventHandlers.call(this);
var filesList=this.element.find('.files'),
eventData={fileupload:this},
clickEventName='单击'+this.options.namespace;
在上(单击事件名称,'.start a',事件数据,this.\u startHandler);
在(单击EventName,'.cancel a',eventData,this.\u cancelHandler)上;
在(单击EventName,'.delete a',eventData,this.\u deleteHandler)上;
},