jquery 3.0 url.indexOf error

后端 未结 5 795
臣服心动
臣服心动 2020-11-27 10:24

I am getting following error from jQuery once it has been updated to v3.0.0.

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

5条回答
  •  粉色の甜心
    2020-11-27 11:04

    Update all your code that calls load function like,

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

    To

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

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

    This error message comes from jQuery.fn.load function.

    I've come across the same issue on my application. After some digging, I found this statement in jQuery blog,

    .load, .unload, and .error, deprecated since jQuery 1.8, are no more. Use .on() to register listeners.

    I simply just change how my jQuery objects call the load function like above. And everything works as expected.

提交回复
热议问题