I am using RequireJS to load dependencies.
Here is my configuration file:
requirejs.config({ baseUrl: "/js/dist", paths: { jquery: "../bower_components/jquery/dist/jquery.min", bootstrap: "../bower_components/bootstrap/dist/js/bootstrap.min", typeahead: "../bower_components/bootstrap3-typeahead/bootstrap3-typeahead.min", validator: "../bower_components/bootstrapvalidator/dist/js/bootstrapValidator.min", openlayers: "../vendor/openlayers/OpenLayers" }, shim: { bootstrap: { deps: ["jquery"] }, validator: { deps: ["bootstrap"] }, openlayers: { exports: "OpenLayers" } } });
And part of my main application file:
define(["jquery", "bootstrap", "openlayers", "./popup", "typeahead"], function($, Bootstrap, OpenLayers, Popup) { (...) $("#textSearch").typeahead("destroy"); (...) });
Checking Firebug, I see that all dependencies are loading. But calling typeahead() in the search text box displays the following message: "TypeError: $(...).typeahead is not a function"
I cannot understand this error as all dependencies are loaded (e.g. typeahead).
Can you help me? thanks in advance
javascript jquery requirejs twitter-bootstrap-3
Harkonnen
source share