Problems with the jquery plugin Tokeninput

拥有回忆 提交于 2019-12-11 18:38:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!