首页 > 其他分享 >url.indexOf is not a function ,使用jquery load()出现错误

url.indexOf is not a function ,使用jquery load()出现错误

时间:2022-10-28 17:35:38浏览次数:54  
标签:function jquery indexOf load url 使用

https://blog.csdn.net/cvper/article/details/79150566

问题:在使用 jquery 3.3.1 版本时,写了如下测试代码:

<script>

$(window).load(function(){

console.log("just a test!");

});

</script>

运行出错:TypeError: url.indexOf is not a function ..........

 

原因: .load() , .error() , .unload() ,已经不在支持,jquery1.8版本之后的都无法再使用;

 

解决办法:使用 .on("load",function(){.................}) 来代替 .load() 即可;

标签:function,jquery,indexOf,load,url,使用
From: https://www.cnblogs.com/Dongmy/p/16836824.html

相关文章