When you see this error:
“uncaught typeerror: $ is not a function”
It almost always means that a jQuery piece of code is being run before the jQuery library has been initialised and loaded.
Oftentimes, your code will wait for jQuery to load before continuing any processing, this is almost always done as follows:
However, it’s not uncommon to get an “TypeError: $ is not a function” error in response.
Some developers resolve this by wrapping their code as follows:
What this does is, it forces a scoped
jQuery variable to be re-aliased within an anonymous function in your application.
Alternatively, you can just do the following: