I did some inspection on Google Console for my website and I got this error “Uncaught Reference Error: $ is not defined.”
It is most probably linked to YETT - a webpage library to control the execution of (third party) scripts - that has been added by the coder while improving my website speed and performance.
YETT script has been added to the theme SNIPPET and also on the THEME.LIQUID
On the SNIPPET this is the code:
On the THEME.LIQUID
Just After the there is the inclusion of YETT script
Regarding your first question “Uncaught Reference Error: $ is not defined”. The error means your code is using jQuery without including the library. You can fix this by including jQuery library. You can quickly grab jQuery CDN to put to here: https://releases.jquery.com/
Question 2: I’m not sure but in my opinion, it is correct
Question 3+4: I don’t really understand your questions and contexts. Can you elaborate more?
Essentially that error means that you either don’t have jQuery installed or the script is being loaded before jQuery’s initialization. If the app you’re using requires jQuery to be installed, you should contact the developers to assist you.
It’s also important to bear in mind that jQuery is pretty heavy and, although it is widely used, it is slowly becoming deprecated and avoided.
Question 3+4: I don’t really understand your questions and contexts. Can you elaborate more?
Sure! Actually the questions 3 and 4 refer to the same thing.
What I mean is that YETT has been added to block the Judge.me + Tawk.to apps.
Since I have deleted the judge me app from the theme, the YETT is failing in blocking the Judge me app as it has been deleted. So my guessing is that in the snippet code of Yett there should be a portion of code referring to the blocking of the Judge.me app, but I am no coding expert.
I have tried to remove the Judge from here
YETT_BLACKLIST = [
/judge/, /tawk.io/]
but the "Failure to block app" is still there. No change at all.
There is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope. Basically $ is an alias of jQuery() so when you try to call/access it before declaring the function, it will endup throwing this $ is not defined error . This usually indicates that jQuery is not loaded and JavaScript does not recognize the $. Even with $(document).ready , $ is still going to be undefined because jquery hasn’t loaded yet.
To solve this error:
Load the jQuery CDN library at the beginning of all your javascript files/scripts which uses $ or jQuery, so that $ can be identified in scripts .