How do I check whether jQuery is loaded in the page or not? I have to run a jQuery script which has a jQuery library link, but when I use the code I want to make sure to load that file only if the page does not have any jQuery file, otherwise use that file. Any suggestions?
4 Answers
if (typeof jQuery == 'undefined') { // This means jQuery is not loaded } Also, take a look at yepnope.js, it allows you to load different JavaScript files based on if certain conditions are true or false.