An auto suggest tags input in vanillajs.
Demo: http://ashish-r.github.io/tags-autosuggest
Just include the index.js file in your project and convert any input field into autosuggest tags input.
<input id ="autosuggest-input" />
new AutoSuggestTagInput(
document.getElementById('autosuggest-input'), // Input element
dataSet, // Data set an array of objects
'labelKey',
'valueKey',
true // Should also serach keys
)
-
On typing a letter the relevant suggestions appear on the list.
-
On clicking up / down arrow suggestions get highlight
-
Select Suggestion with mouse click or enter.
-
On selecting on the option in the list it gets tagged in the search bar.
-
On clicking the cross on the tagged item, it gets removed from the search bar
-
If there is no term in search bar and if you press backspace the last tagged item gets highlight. On another backspace press the last tagged item gets deleted.