[Solved-3 Solutions] jquery 3.0 url.indexOf error



Error Description:

    • We get the following error from jQuery once it has been updated to

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

    Solution 1:

      • Update all your code that calls load function like,
      $(window).load(function() { ... });
      
      click below button to copy the code. By - jquery tutorial - team
      • To
      $(window).on('load', function() { ... });
      
      click below button to copy the code. By - jquery tutorial - team

      Solution 2:

        • Jquery 3.0 has some breaking changes that remove certain methods due to conflicts. Your error is most likely due to one of these changes such as the removal of the .load() event.
        • Read more in the jQuery Core 3.0 Upgrade Guide
        • To fix this you either need to rewrite the code to be compatible with Jquery 3.0 or else you can use the JQuery Migrate plugin which restores the deprecated and/or removed APIs and behaviours

        Solution 3:

          • To fix this issue you should update your code from:
              .load();
          
          click below button to copy the code. By - jquery tutorial - team
          • To
              .trigger("load");
          
          click below button to copy the code. By - jquery tutorial - team

          Related Searches to jquery 3.0 url.indexOf error