Mar 21, 2015

[SOLVED] Uncaught Error: Bootstrap's JavaScript requires jQuery

This is quite a simple error you might encounter even when you've already included both jquery and bootstrap.js files.

Solution: Re-arrange the order of script tags in html file so that jquery is at the top, and bootstrap.js is anywhere after the jquery.js file.

This will cause the "uncaught error":

  <!-- js libs -->
  <!-- twbs jquery underscore backbone -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
  <script src="/js/lib/jquery-1.11.2.js"></script>
  <script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
  <script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>


Problem solved:


  <!-- js libs -->
  <!-- jquery twbs underscore backbone -->
  <script src="/js/lib/jquery-1.11.2.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
  <script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
  <script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>

No comments:

Post a Comment