Coder Perfect

When creating a new foundation project, you get a “Uncaught TypeError: a.indexOf is not a function” problem.


With foundation new my-project, I’ve started a new Foundation 5 project using bash. When I view the index.html page in Chrome, the console displays an Uncaught TypeError: a.indexOf is not a function error from jquery. min.js:4.

I followed the procedures on the foundation site to create the project, but I’m still getting this issue. Foundation and jQuery appear to be successfully included and linked in the index.html file and linked app. $$$$$$$$$$$$$$$$$$$$$ (document). foundation();

Is there anyone who can tell me what’s generating this error? and what would a solution be?

Asked by FreddieE

Solution #1

The jQuery event-aliases.load(),.unload(), and.error() have all been deprecated since jQuery 1.8, therefore this issue could be caused by them. Look in your code for these aliases and replace them with the.on() method. Replace the following deprecated excerpt, for example:


with the following:

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

Answered by Daniel Llano

Solution #2

Please use the jQuery Migrate Plugin listed below.

<script src=""></script>
<script src=""></script>

Answered by Govarthanan Venunathan

Solution #3

Incompatible jQuery versions are a common source of this problem. With a foundation 6 repository, I got the same error. Although my repository used jQuery 3, foundation requires an older version. After that, I made a tweak, and it worked.

If you look at the version of jQuery required by the foundation 5 dependencies it states “jquery”: “~2.1.0”.

Can you ensure that you’re using the correct jQuery version?

I hope this information is useful.

Answered by shaune

Solution #4

This was a problem for me as well. I was working with jquery. poptrox.min.js for image popping and zooming and I received an error which said:

This is because indexOf was not supported in 3.3.1/jquery.min.js, therefore switching to an older version 2.1.0/jquery.min.js is a straightforward remedy.

This was the solution for me.

Answered by Harshit Pant

Solution #5

One of the possible causes is loading jQuery TWICE, as in:

<script src='..../jquery.js'></script>
<script src='......./jquery.js'></script>

Check your source code for duplicate jQuery loads and eliminate them.

Answered by T.Todua

Post is based on