jquery.js 3.0报错, Uncaught TypeError: url.indexOf is not a function

2023-05-25,,

转载自:http://majing.io/questions/432
 
问题描述

jQuery升级到3.0.0后类型错误

jquery.js:9612 Uncaught TypeError: url.indexOf is not a function

问题解决

这个错误是由于调用了load函数导致的错误

把代码里调用load函数的方式

$(window).load(function() { ... });

改为

$(window).on('load', function() { ... });

注意:.load(), .unload(), and .error()从jQuery 1.8开始就被废弃了,换成使用.on()函数来注册.

错误信息

jquery.js:9612 Uncaught TypeError: url.indexOf is not a function

就是源自jQuery.fn.load函数

jquery.js 3.0报错, Uncaught TypeError: url.indexOf is not a function的相关教程结束。

《jquery.js 3.0报错, Uncaught TypeError: url.indexOf is not a function.doc》

下载本文的Word格式文档,以方便收藏与打印。