How to check if jQuery is loaded

This post is a result of my analysis of my Google Analytics logs. It seems a lot of people need to know how to check whether jQuery is loaded. I will demonstrate two options here. To check if jQuery exists use:

if (jQuery) {
alert('jQuery is loaded!');

Alternatively you can check if jQuery is not loaded by using:

if (typeof jQuery == 'undefined') {
alert('jQuery has not been loaded!');


Post a Comment