javascript - 新版jquery去掉load事件了吗?
伊谢尔伦
伊谢尔伦 2017-04-11 11:06:27
0
4
1062

jquery版本为3.1.1,使用ajaxfileupload.js,结果报错
url.indexOf is not a function
进去查看,应该是调用jquery的load方法出错,
ajaxfileupload中是
jQuery('#' + frameId).load(uploadCallback );

return {abort: function () {}};

},
应该是想使用load事件,缺被判断成了ajax的load方法,3.1.1中用什么替代了load事件?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(4)
刘奇

好吧…全都用.on绑定就可以了

巴扎黑

url.indexOf is not a function
说的是url这个对象的问题,建议贴更详细的报错。

迷茫

今天也遇到了这个问题,查了一下文档,确实从3.0开始移除了load、unload、error事件方法。不过依然可以用on方法绑定这些事件。

Breaking change: .load(), .unload(), and .error() removed

These methods are shortcuts for event operations, but had several API limitations. The event .load() method conflicted with the ajax .load() method. The .error() method could not be used with window.onerror because of the way the DOM method is defined. If you need to attach events by these names, use the .on() method, e.g. change $("img").load(fn) to $("img").on("load", fn).

https://github.com/jquery/jqu...

https://jquery.com/upgrade-gu...

大家讲道理

你好,我和你遇到了同样的问题。
请问,怎么on绑定呢,我对jQuery不熟悉,刚刚开始学习,谢谢。

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!