How to upgrade from the old HubSpot supplied jQuery to the latest version available.
Identify where jQuery is being used
?hsNoJQuery=true&hsDebug=true
to the end of the URL, and hit enter.https://www.my-website.com/?hsNoJQuery=true&hsDebug=true
You added query parameters. This specific one tells HubSpot to disable jQuery when loading the page. This only affects what you see and doesn’t break the site for other visitors.Now right-click anywhere on the page and choose “inspect”. The exact wording may differ slightly depending on which web browser you’re using. This is the developer tools for your web browser."Uncaught ReferenceError: $ is not defined"
That error should also state a file name that’s producing that error.Add new version of jQuery in a testing mode
{% set oldjQueryVersion = 1.7 %}
change the number 1.7 to 1.11. This ensures the correct version of jQuery will load on your site during testing.Now check if the checkbox for “Load HubSpot’s included jQuery library from your footer” is enabled.If it’s disabled, where you see{% set oldjQueryLocation = "footer" %}
, change the “footer” text to say “head”.Find the jQuery checkbox and disable it.Save the settings.Test areas of your site that you know use jQuery for issues
?latest_jquery=true
to the end of the URL, hit enter.You are viewing what the page looks and functions like with the latest version of jQuery.If you closed the developer tools before, reopen them by right clicking and inspecting anywhere on the page.Look in the console for those Uncaught ReferenceError: $ is not defined
errors. If you don’t see one, congratulations you followed step 2 correctly. If you see any errors or warnings that were not there prior see Advanced troubleshooting.Now review your list of pages and files you logged earlier. Go to the pages that had those errors and add the query parameter ?latest_jquery=true
to the URL and hit enter.If everything went smoothly you shouldn’t see any new errors and you shouldn’t see any Uncaught ReferenceError: $ is not defined
errors.Click around the pages on anything that’s intended to be interactive on the page, dropdowns, forms, search fields etc. If everything works as expected you should be able to transition safely.head
. If you previously needed to set oldjQueryLocation
to "head"
you can improve page load times by making an update to the code. If you did not need to do that, skip to step 4, you’re already loading from the footer.Go back to your site settings where your the code is. Immediately below {# embed the latest jQuery version #}
there are two require_js
functions. Remove the ,oldjQueryLocation
from those two functions. Do not remove it from the require_js
functions within the else
statement — that code is being used on your site while you are testing.?latest_jquery=true
parameter. Again check all of the same pages, looking for Uncaught ReferenceError: $ is not defined.
What you’re testing for this time is whether moving this script to your footer will break any scripts on your site.If you test all of the pages with the query parameter and don’t find any of those errors then congratulations, you will be able to load jQuery in the footer. Carry on to the next step.If you did find those errors, you have two options.Go live with the updated version of jQuery
newLocation = "footer"
to newLocation = "head"
You are now ready to save the settings.Congratulations you’ve successfully upgraded to the latest version of jQuery.