A plugin created for search suggestions that is more flexible.
Most search suggestion plugins were very strict, didn't allow users to still write naturally while using suggestions, only allowing search suggestions to be at the end of input text, AnyAutoComplete solves this!
- -jQuery 2.*
Use npm
npm install --save anyautocomplete
Use bower
bower install --save AnyAutoComplete
or Download minified script from GitHub
https://github.com/gggordon/AnyAutoComplete/blob/master/AnyAutoComplete.min.js
Then Include in html file
<script type="text/javascript" src="AnyAutoComplete.min.js"></script>
This plugin integrates well with bootstrap. Without bootstrap, you may include the default stylesheet
<link rel="stylesheet" type="text/javascript" href="AnyAutoComplete.css" />
With jQuery
$('.suggestion-boxes').anyAutoComplete(options);
or standalone
new AnyAutoComplete(divNode, options);
where
divNode - HTMLInputElement - textbox node
options - Object
=================
options : {
dataSource : { //keywords or suggestions
'Cat 1 Name':[
'Elem 1',
'Elem 2'
],
'Cat 2 Name':[
'Elem 1',
'Elem 2'
]
}
}
Enjoy this project and if you have any issues feel free to state them here on github or contribute.