I'm making a "token input" style checkbox with an autocomplete (user types in something, selects a response, which adds a "token" to the DOM view).
Using jQuery autocomplete, is there a way to add values that aren't in the source
list after the user types them in?
For example, a source looks like ["Apples", "Oranges", "Bananas"]
. The user types in "plums,"
when using the text field. Is there a way to add "Plums" to the list of sources if the user so desires? I know there are select
and change
events that I can check, but select
only works if there's something to select (there isn't in this case), and change
would require some kind of timeout check to verify that the user had stopped typing.
Conversely, is there another plugin I could use to accomplish this behavior?
change
should work here. It includes a timeout after the person has stopped typing and has navigated away from the field. What problems did you encounter when trying to use it? – Erythrocytometer