$("#responsible").tokenInput(
[
{id: 7, name: "a@gmail.com"},
{id: 11, name: "b@gmail.com"},
{id: 13, name: "c@gmail.com"},
{id: 17, name: "d@gmail.com"},
{id: 19, name: "e@yahoo.com"},
{id: 23, name: "f@gmail.com"},
{id: 29, name: "abc@gmail.com"},
{id: 31, name: "ab@gmail.com"}
],{
prePopulate: respArray,
hintText: "Enter mailid",
allowCustomEntry: true,
theme : "facebook",
noResultsText: "O noes",
searchingText: "Searching...",
minChars: 1,
tokenLimit: 1,
tokenValue: "name",
preventDuplicates: true
}
);
答案 0 :(得分:3)
使用@Cindrella测试:
$("#responsible").tokenInput(
[
{id: 7, name: "a@gmail.com"},
{id: 11, name: "b@gmail.com"},
{id: 13, name: "c@gmail.com"},
{id: 17, name: "d@gmail.com"},
{id: 19, name: "e@yahoo.com"},
{id: 23, name: "f@gmail.com"},
{id: 29, name: "abc@gmail.com"},
{id: 31, name: "ab@gmail.com"}
],{
prePopulate: respArray,
hintText: "Enter mailid",
allowCustomEntry: true,
theme : "facebook",
noResultsText: "O noes",
searchingText: "Searching...",
minChars: 1,
tokenLimit: 1,
tokenValue: "name",
allowFreeTagging: false, // !ADD THIS !
preventDuplicates: true
}
);
答案 1 :(得分:0)
试试这个:
$("#responsible").tokenInput(
[
{id: 7, name: "a@gmail.com"},
{id: 11, name: "b@gmail.com"},
{id: 13, name: "c@gmail.com"},
{id: 17, name: "d@gmail.com"},
{id: 19, name: "e@yahoo.com"},
{id: 23, name: "f@gmail.com"},
{id: 29, name: "abc@gmail.com"},
{id: 31, name: "ab@gmail.com"}
],{
prePopulate: respArray,
hintText: "Enter mailid",
allowFreeTagging: true,
theme : "facebook",
noResultsText: "O noes",
searchingText: "Searching...",
minChars: 1,
tokenLimit: 1,
tokenValue: "name",
preventDuplicates: true
}
);
包含allowFreeTagging:启动时为true。