jqueryjquery-3

jquery 3.0 url.indexOf error


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

Any Idea why?


Solution

  • 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.