Skip to content
Advertisement

Uncaught TypeError: $ is not a function at (index):2

I faced with this error on my WordPress website “Uncaught TypeError: $ is not a function at (index):2”

I found this solution to add

JavaScript

before the

JavaScript

But, I couldn’t find the “$( document ).ready(function(){” code in the theme folder of my website to fix it.

here is the exact code via inspect, sources window of chrome browser

JavaScript

});

Advertisement

Answer

Most wordpress templates already call noConflict()

When you want to use $ in your code it is better to use an IIFE wrapper instead

JavaScript

Also make sure you aren’t trying to use jQuery before the library is loaded. using wp_enqueue_script() will take care of that issue

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement