# This is a fork of a fork of Bootstrap Typeahead that adds minimal but powerful extensions. * Ability to disable autoselect of first matched element. * Ability to automatically set the width of the dropdown to that of the text input. * Ability to fetch source element via AJAX * Ability to have a comma separated list of tags. For the proper source, and other examples, please see [the original gist](https://gist.github.com/1866577). ### Example showing off all the above features ```javascript // This example is in Javascript, fetches a tag via AJAX and appends it to the comma separated list of tags $('#tags').typeahead({ source: function(typeahead, query) { var term = $.trim(query.split(',').pop()); if (term == '') return []; $.getJSON('/tags/typeahead.json' + '?', { term: term }, function(data) { typeahead.process(data); }); } , onselect: function(item, previous_items) { terms = previous_items.split(','); terms.pop(); terms.push(item); terms.push(''); $.each(terms, function(idx, val) { terms[idx] = $.trim(val); }); $('#tags').val(terms.join(', ')); } // Matcher always returns true since there are multiple comma-seperated terms in the input box and the server ensures only matching terms are returned , matcher: function() { return true; } // Autoselect is disabled so that users can enter new tags , autoselect: false }); ```