This time I will share jQuery Plugin and tutorial about Simple Inline Autocomplete / Autosuggest Plugin – suggest.js, hope it will help you in programming stack.
suggest.js is a simple-to-use jQuery plugin for auto- suggesting and completing text in an input field based on user input, as in line prediction based in an array of predefined suggestions.
Features:
- Autocomplete and update the input field by Tab or Enter keys.
- Switch between suggestions by Up and Down arrow keys.
How to use it:
1. Include the latest version of jQuery and the jQuery suggest plugin at the bottom of the document.
1 |
< script src = "//code.jquery.com/jquery-1.11.3.min.js" ></ script > |
2 |
< script src = "src/jquery.suggest.js" ></ script > |
2. Add an array of characters for autosuggest.
1 |
var words = ["Item 1", "Item 2", "Item3", ...]; |
3. Call the plugin on the target input field and pass the source
parameter.
1 |
$( 'input' ).suggest(words); |
4. Full customization options.
01 |
$( 'input' ).suggest(words,{ |
04 |
suggestionColor : '#ccc' , |
07 |
moreIndicatorClass : 'suggest-more' , |
08 |
moreIndicatorText : '…' |
This awesome jQuery plugin is developed by polarblau. For more Advanced Usages, please check the demo page or visit the official website.