{"id":4618,"date":"2009-11-05T11:15:30","date_gmt":"2009-11-05T18:15:30","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=4618"},"modified":"2009-11-05T11:15:49","modified_gmt":"2009-11-05T18:15:49","slug":"check-if-jquery-is-loaded","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/jquery\/check-if-jquery-is-loaded\/","title":{"rendered":"Check if jQuery is Loaded"},"content":{"rendered":"
if (typeof jQuery == 'undefined') {\r\n\r\n    \/\/ jQuery IS NOT loaded, do stuff here.\r\n\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

if (typeof jQuery == ‘undefined’) { \/\/ jQuery IS NOT loaded, do stuff here. }<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3245,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":7720,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/load-jquery-only-if-not-present\/","url_meta":{"origin":4618,"position":0},"title":"Load jQuery Only If Not Present","date":"October 19, 2010","format":false,"excerpt":"Say you were going to do an include on a whole bunch of pages, and inside of that include you wanted to do some jQuery specific stuff. That page may or may not already have jQuery loaded. If it already does, you don't want to load it again, but if\u2026","rel":"","context":"With 21 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3780,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/loading-jquery\/","url_meta":{"origin":4618,"position":1},"title":"Loading jQuery","date":"September 4, 2009","format":false,"excerpt":"Load with Google API Direct Link to Google Check if loaded, only load if unloaded var jQueryScriptOutputted = false; function initJQuery() { \/\/if the jQuery object isn't available if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { \/\/only output the script once.. jQueryScriptOutputted = true; \/\/output the script (load it\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6160,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/jquery-plugin-template\/","url_meta":{"origin":4618,"position":2},"title":"jQuery Plugin Template","date":"April 10, 2010","format":false,"excerpt":"Replace instances of \"yourPluginName\" with your actual plugin name. The stuff about \"radius\" is just an example of an option (parameter to pass plugin). (function($){ $.yourPluginName = function(el, radius, options){ \/\/ To avoid scope issues, use 'base' instead of 'this' \/\/ to reference this class from internal events and functions.\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":206756,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/make-an-jquery-hasattr\/","url_meta":{"origin":4618,"position":3},"title":"A jQuery hasAttr() Equivalent","date":"August 19, 2015","format":false,"excerpt":"jQuery doesn't really have an .hasAttr() function. You might assume that it does, but alas, it does not. A StackOverflow thread has some pretty good solutions. Get the attribute, check the value var attr = $(this).attr('name'); \/\/ For some browsers, `attr` is undefined; for others, `attr` is false. Check for\u2026","rel":"","context":"With 5 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3810,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/fix-minmax-width-for-browsers-without-native-support\/","url_meta":{"origin":4618,"position":4},"title":"Fix Min\/Max-Width for Browsers Without Native Support","date":"September 4, 2009","format":false,"excerpt":"This script checks all elements with a class of .fixMinMaxwidth and observes the window. It's only applied to browsers without native min\/max-width support such as ie6 and below. Window resizing won't be a problem either.","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6284,"url":"https:\/\/css-tricks.com\/snippets\/jquery\/fallback-for-cdn-hosted-jquery\/","url_meta":{"origin":4618,"position":5},"title":"Fallback for CDN hosted jQuery","date":"April 30, 2010","format":false,"excerpt":"Several big companies offer copies of jQuery hosted on their CDN's (Content Delivery Network). Most notoriously Google, but also Microsoft and jQuery themselves. A lot of people swear by this since it saves bandwidth, downloads faster, and perhaps even stays cached jumping between different sites that use the same script.\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4618"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=4618"}],"version-history":[{"count":2,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4618\/revisions"}],"predecessor-version":[{"id":4620,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/4618\/revisions\/4620"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3245"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=4618"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=4618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}