Anyone else encountered this problem and how did you fix?
Nov 23, 2018
5
Level 51
Bootstrap Typeahead select
Hi all,
I can't seem to get my code to work so when a user selects from the autocomplete it enters into the input.
Heres the code:
// JS
let path = "{{ url('search/landlord') }}";
$('#search').typeahead({
minLength: 3,
source: function (query, process, ) {
return $.get(path, { query: query }, function (data) {
return process(data);
});
},
select: function( ui, item ) {
console.log(item);
}
});
// HTML
<input type="text" class="form-control" name="term" id="search" placeholder="Start typing something to search..." data-provide="typeahead" autocomplete="off">
So things like ui.item.value & ui.item.name also show undefined.
Both console.log(item); and console.log(ui); shows as undefined... Any suggestions on whats wrong or what I may have missed.
Please or to participate in this conversation.