AnsweredAssumed Answered

Uncaught Error: Bootstrap's JavaScript requires jQuery

Question asked by alterwiel on May 13, 2015
Latest reply on Feb 10, 2016 by bokeefe

I'm developing a custom search widget that references jQuery and Bootstrap libraries. The search textbox is a Twitter Bootstrap Typeahead.

 

I get 'Uncaught Error: Bootstrap's JavaScript requires jQuery' in the console when I load webapp/?config=config.json.  My init.js resources array looks like this:

 

resources = resources.concat([

   window.apiUrl + 'dojo/resources/dojo.css',

   window.apiUrl + 'dijit/themes/claro/claro.css',

   window.apiUrl + 'esri/css/esri.css',

   window.apiUrl + 'dojox/layout/resources/ResizeHandle.css',

   window.path + 'jimu.js/css/jimu.css',

   window.path + 'widgets/search/scripts/jquery-2.1.1.min.js',

   window.path + 'widgets/search/scripts/typeahead.jquery.min.js',

   window.path + 'widgets/search/scripts/bloodhound.min.js',

   window.path + 'widgets/search/scripts/typeahead.bundle.min.js',

   window.path + 'widgets/search/scripts/bootstrap.min.js',

   window.path + 'widgets/search/css/typeahead.css',

   window.path + 'widgets/search/css/bootstrap.min.css',

   window.path + 'widgets/search/css/bootstrap-theme.min.css'

]);

 

As you can see, jquery-2.1.1.min.js precedes bootstrap.min.js in the array, and yet the error message would indicate that bootstrap is being loaded first. Hitting F5 a few times gets it to load successfully, but this appears random, and obviously is not a solution.

Outcomes