Tuesday, June 2FreeJQuery

How to Load jQuery Conditionally

In This Article We read about Load jQuery Conditionally Many developers like to link to an externally hosted jQuery library, like for example Google’s jQuery

Check it out:


<!– Grab Google CDN jQuery. fall back to local if necessary –>

<script src=”//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script>


window.jQuery && document.write(‘<script src=”js/jquery-1.4.2.min.js”><\/script>’)


Of course, you’ll need to insert your own path to wherever your local jQuery files are located (instead of ‘<script src=”js/jquery-1.4.2.min.js”></script>’), but this is a very simple way to make sure that your jQuery library always loads.


Leave a Reply

Your email address will not be published. Required fields are marked *