Simple Inline Autocomplete / Autosuggest Plugin - suggest.js

File Size: 16.6 KB
Views Total: 9855
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Simple Inline Autocomplete / Autosuggest Plugin - suggest.js

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.

See also:

How to use it:

1. Include the latest version of jQuery and the jQuery suggest plugin at the bottom of the document.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="src/jquery.suggest.js"></script>

2. Add an array of characters for autosuggest.

var words = ["Item 1", "Item 2", "Item3", ...];

3. Call the plugin on the target input field and pass the source parameter.

$('input').suggest(words);

4. Full customization options.

$('input').suggest(words,{

  // the color of the suggestions
  suggestionColor       : '#ccc',

  // style the small indicator, appearing when the plugin has found more than one suggestion
  moreIndicatorClass    : 'suggest-more',
  moreIndicatorText     : '&hellip;'
  
});

 


This awesome jQuery plugin is developed by polarblau. For more Advanced Usages, please check the demo page or visit the official website.