Bootstrap autocomplete autocomplete from multiple sources?
Using Bootstrap Typeahead script, I would like to make an autocomplete input box. Entry field:
<input type="text" class="input-medium search-query" id="name" data-provide="typeahead" autocomplete="off">
I have JSON data, whose simple version looks like this:
var name_list = {
"first" = ["John", "Jonathan", "Tom"],
"last" = ["James", "Smith", "Bush"]
}
And when something is entered into the textbox, now I only show the list from the first one.
$('#name').typeahead({source: name_list.first);
But I would also like to show the names from "last". For example, if I find "j" I want to see
John
Jonathan
(ideally with a divide line from Bootstrap css)
James
in the autocomplete list. How can i do this? Is there a way to call multiple JSON data sources?
+3
source to share
No one has answered this question yet
Check out similar questions: