oHi guys, on page load i see this error in console: "Uncaught ReferenceError: _ is not defined"
i have this code in head:
<!-- Jquery -->
<script src=".10.1.min.js"></script>
<script src=".2.1.min.js"></script>
<!-- Typeahead -->
<script src="js/typeahead/typeahead.js"></script>
I have no idea whats happening, and i cannot google anything about this kind of typeahead.js problem. I will appreciate any help. Thanks
oHi guys, on page load i see this error in console: "Uncaught ReferenceError: _ is not defined"
i have this code in head:
<!-- Jquery -->
<script src="http://code.jquery./jquery-1.10.1.min.js"></script>
<script src="http://code.jquery./jquery-migrate-1.2.1.min.js"></script>
<!-- Typeahead -->
<script src="js/typeahead/typeahead.js"></script>
I have no idea whats happening, and i cannot google anything about this kind of typeahead.js problem. I will appreciate any help. Thanks
Share Improve this question asked Aug 4, 2014 at 13:46 Michael CeraMichael Cera 1431 silver badge11 bronze badges 2- check the network tab of developer tools(F12 > Network) to see if all your scripts are getting loaded correctly – wirey00 Commented Aug 4, 2014 at 13:51
- Yes, all scripts are loaded correctly. – Michael Cera Commented Aug 4, 2014 at 13:54
3 Answers
Reset to default 3Where did you get your tipeahead script? Looks like it relies on Underscore.js or Lo-Dash
We need more information anyway (stacktrace, how you load the typeahead script, and its content).
I got this error when I was referencing typeahead.bundle.js from the /src/ (source) folder of the bower package instead of the /dist/ (distribution) folder by mistake.
By pointing at the /dist/typeahead.bundle.js instead it works fine without the need to add Underscore.js or Lo-Dash manually.
If you look here you'll see the instructions for installing this library. The _
that it's missing is defined in bloodhound.js
. You can see where it is defined in this file around line 6.
Try adding that link before your typeahead
script and see if that fixes the problem.
This all may be included with the typeahead script you're loading, which would make my answer wrong, but try it out and see if that fixes it.
Edit: here is the definitions of _
in the github repo