Using Typeahead.js plugin on ASP MVC 3 page
I'm trying to use the typeahead plugin without any luck right now. I've tried a number of jQuery libraries and I get the same error message each time:
Uncaught TypeError: Object [object Object] has no method 'typeahead'
Here are the declarations I'm tried using and the typeahead code
<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#typeahead').typeahead({
source: function (term, process) {
var url = '@Url.Content("~/Home/GetNames")';
return $.getJSON(url, { term: term }, function (data) {
return process(data);
});
}
});
})
</script>
and here is the input tag that the plugin is supposed to work on
<form class="navbar-search pull-left">
<input type="text" value="" id="typeahead" data-provide="typeahead" class="search-query" /> @*placeholder=" Agent search" />*@
</form>