Loading the latest jQuery version

Posted by & filed under Javascript.

1) Load the “latest” CND jquery.
2) Add a local fall-back version.

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"/><script>
<!-- if no jquery is available load the local one -->
<script>
jQuery(document).ready(function(){
    if (typeof jQuery == 'undefined') {
	var head = document.getElementsByTagName("head")[0];
	script = document.createElement('script');
	script.id = 'jQuery';
	script.src = '/includes/js/jquery/jquery.js';
	head.appendChild(script);
    }
});
</script>

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Bitnami