5
$("#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
            }
);
  1. 令牌输入不适用于自定义条目。一旦光标离开输入,文本将从输入中消失。我怎么解决这个问题。
4

2 回答 2

3

用@Cindrella 测试:</p>

$("#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
        }
);
于 2013-11-06T05:09:17.663 回答
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 。

于 2015-07-29T09:59:27.597 回答