jQuery fix for "Uncaught TypeError: $ is not a function" error


This question already has an answer here:


Use the following statement in a JS file.


// jQuery code is in here


After declaring the above statement you will be able to use $ sign.

It was using an old version of jQuery.

I updated the version and this resolved the issue for me.


I think the issue was because the external javascript was loaded first before the jquery was loaded. To solve this use requirejs, follow this link for the usage http://requirejs.org/docs/api.html

Need Your Help

Recursively remove empty elements and subarrays from a multi-dimensional array

php arrays multidimensional-array filtering is-empty

I can't seem to find a simple, straight-forward solution to the age-old problem of removing empty elements from arrays in PHP.