TypechoJoeTheme

香草物语

统计
登录
用户名
密码
/
注册
用户名
邮箱
输入密码
确认密码

TypeError: url.indexOf is not a function

Laughing博主
2017-01-01
/
0 评论
/
1,209 阅读
/
50 个字
/
百度已收录
01/01
本文最后更新于2023年05月17日,已超过350天没有更新。如果文章内容或图片资源失效,请留言反馈,我会及时处理,谢谢!

问题

在使用 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() 即可。

jQuery
朗读
赞(0)
赞赏
感谢您的支持,我会继续努力哒!
版权属于:

香草物语

本文链接:

https://www.xiangcaowuyu.net/web/typeerror-urlindexof-is-not-a-function.html(转载时请注明本文出处及文章链接)

评论 (0)
  1. xx 闲逛
    MacOS · Google Chrome

    看看

    2020-02-20 回复
  2. 飞鸟 闲逛
    MacOS · Google Chrome

    非常好,感谢!

    2019-06-21 回复