我是靠谱客的博主 懦弱荷花,这篇文章主要介绍jquery3.0移除了.load()方法,现在分享给大家,希望可以做个参考。

参考链接:新版jquery去掉load事件了吗?

今天也遇到了这个问题,查了一下文档,确实从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).

就是说以前直接$(obj).load(),现在被改为$(obj).on('load',fn)了,好吧~

转载于:https://www.cnblogs.com/zjfblog/p/8334132.html

最后

以上就是懦弱荷花最近收集整理的关于jquery3.0移除了.load()方法的全部内容,更多相关jquery3内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部