Streaming live at 10am (PST)

jQuery console errors with custom code

#1

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?

#2

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

#3

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.

#4

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/

#5

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

$(function() {

$(document).ready(function() {

var tabmodal = $("#tab_modal");

#6

Read up.

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

#7

It looks like I’m using them properly.

#8

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

#9

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.