I would like two different text inputs to have typeahead, each with a different source function. For example, you get first_names and other last_names.
Here's how it looks and doesn't work:
$('#first_name').typeahead({ source: function (query, process) { $.get('/users/typeahead-first-name', { term: query }, function (data) { return process(JSON.parse(data)); }); } }); $('#last_name').typeahead({ source: function (query, process) { $.get('/users/typeahead-last-name', { term: query }, function (data) { return process(JSON.parse(data)); }); } });
The first typeahead works fine. However, the second one, when I start to enter text and the parameters begin to appear, then I press the button, the drop-down menu just closes and no value is entered in the input field.
Has anyone figured out how to make it work?
source share