jQuery and jQuery UI CDN with fallback


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!-- Grab Google CDN's jQuery & jQuery UI. Fall back to local if necessary -->
  2. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  3. <script type="text/javascript">
  4. if (typeof jQuery == 'undefined') {
  5. document.write(unescape("%3Cscript src='/js/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E"));
  6. }
  7. </script>
  8. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
  9. <script type="text/javascript">
  10. if (typeof jQuery.ui == 'undefined') {
  11. document.write(unescape("%3Cscript src='/js/jquery-ui.min.js' type='text/javascript'%3E%3C/script%3E"));
  12. }
  13. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.