问题
I use the jquery plugin Tokeninput that allow autocomplete in textBox. I would prevent user from selecting duplicate words inn the dropdown of autocomplete.
Does anybody have any suggestion to resolve this problem?
Thanks a lot in advance.
回答1:
It looks like there is a setting for preventDuplicates which prevents user from selecting duplicate values by setting this to true. The default is false, you would want to set the to true.
$(document).ready(function() {
$("#demo-input").tokenInput("path/to/list", {
preventDuplicates: true
});
});
You can also see the demo here: http://loopj.com/jquery-tokeninput/demo.html#prevent-duplicates. Hope this helps
来源:https://stackoverflow.com/questions/24699683/problems-with-the-jquery-plugin-tokeninput