Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery url.indexOf is not a function

I have just installed jQuery using

npm install jquery

After merging jquery,bootstrap in a vendor file using Webpack , I am keep on getting following error

vendor.4b59d15129c2efa4408c.js:9979 Uncaught TypeError: url.indexOf is not a function
    at jQuery.fn.init.jQuery.fn.load (vendor.4b59d15129c2efa4408c.js:9979)
    at Object.<anonymous> (bundle.7beebbf8c43d73f31563.js:55)
    at Object.<anonymous> (bundle.7beebbf8c43d73f31563.js:213)
    at __webpack_require__ (vendor.4b59d15129c2efa4408c.js:55)
    at Object.<anonymous> (bundle.7beebbf8c43d73f31563.js:12)
    at __webpack_require__ (vendor.4b59d15129c2efa4408c.js:55)
    at webpackJsonpCallback (vendor.4b59d15129c2efa4408c.js:26)
    at bundle.7beebbf8c43d73f31563.js:1
like image 228
Aaqib Avatar asked Dec 19 '22 04:12

Aaqib


1 Answers

What is your jQuery version? On version 3, the function $(window).load() is deprecated. When using .load(), .unload(), or .error() it will throw an error.

Replace those function with:

old

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

version 3 above

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

$(window).on('error', function () {} )

my own case was using SuperSimpleSlider jQuery plugins with Vue.js. I have to replace the original file (the plugins) with correct solution.

Hope this helps!

Source: jqueryhouse.com

like image 195
Raynal Gobel Avatar answered Dec 24 '22 01:12

Raynal Gobel