A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.
Start typing in the field below to show the typeahead results.
Call the typeahead via javascript:
$('.typeahead').typeahead()
Name | type | default | description |
---|---|---|---|
source | array | [ ] | The data source to query against. |
items | number | 8 | The max number of items to display in the dropdown. |
matcher | function | case insensitive |
The method used to determine if a query matches an item. Accepts a single argument, the item against which to test
the query. Access the current query with this.query . Return a boolean true if query is a match.
|
sorter | function |
exact match, case sensitive, case insensitive |
Method used to sort autocomplete results. Accepts a single argument items and has the scope of the typeahead instance.
Reference the current query with this.query .
|
highlighter | function | highlights all default matches |
Method used to highlight autocomplete results. Accepts a single argument item and has the scope of the typeahead
instance. Should return html.
|
Add data attributes to register an element with typeahead functionality.
<input type="text" data-provide="typeahead">
Initializes an input with a typeahead.