Streaming live at 10am (PST)

jQuery console errors with custom code

Without adding jQuery via a CDN I receive the following error message with many of my custom code functions no longer executing:
Uncaught ReferenceError: $ is not defined

These errors go away when I include this version of jQuery in my <head>: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js

I A/B’ed the two scripts and they are identical.
https://d1tdp7z6w94jbb.cloudfront.net/js/jquery-3.3.1.min.js

=

https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js

So why then would I receive the Uncaught ReferenceError: $ is not defined message in the console if I didn’t include my own version of jQuery?

@moofawsaw - jQuery is loaded by default. There is no need to include it in custom code.

I understand it is loaded by default, but I receive the Uncaught ReferenceError: $ is not defined if I do not load in https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js.

Without including my own version of it in custom code, Webflow’s version is giving me console errors, specifically Uncaught ReferenceError: $ is not defined.

Without sharing your readonly link or a published link, there is no way for anyone to tell you what you are doing wrong.

https://jquery.com/

50%20PM
These are the functions where this error is given:
$("input.loc-check").change(function() {

$(function() {

$(document).ready(function() {

var tabmodal = $("#tab_modal");

Read up.

https://learn.jquery.com/using-jquery-core/document-ready/

It looks like I’m using them properly.

At a minimum, You should share the complete codeblock. Not partials.

The best way to debug your JS code, is using the browser console. You can test out jQuery selectors and functions right there. Work out your issues, then update your sites Custom Code.

Good luck.

Your issue might be due to your code loading before jquery is loaded.

Try including your code in the page setting under the “Before </body> tag” section. If you need the code globally, add it to the Project Setting Custom Code section under Footer Code.

I hope this helps someone out there!