2013-06-21 3 views
5
$("#responsible").tokenInput(
      [ 
       {id: 7, name: "[email protected]"}, 
       {id: 11, name: "[email protected]"}, 
       {id: 13, name: "[email protected]"}, 
       {id: 17, name: "[email protected]"}, 
       {id: 19, name: "[email protected]"}, 
       {id: 23, name: "[email protected]"}, 
       {id: 29, name: "[email protected]"}, 
       {id: 31, name: "[email protected]"} 
      ],{ 
       prePopulate: respArray, 
       hintText: "Enter mailid", 
       allowCustomEntry: true, 
       theme : "facebook", 
       noResultsText: "O noes", 
       searchingText: "Searching...", 
       minChars: 1, 
       tokenLimit: 1, 
       tokenValue: "name", 
       preventDuplicates: true 
      } 
); 
  1. Токен вход не работает для пользовательского ввода. Как только курсор выйдет из ввода, текст исчезнет с входа. Как я могу решить эту проблему.
+3

Для https://github.com/loopj/jquery-tokeninput 1.6.1 versio try allowFreeTagging: истинный вариант. – Cindrella

ответ

3

Тест с @Cindrella:

$("#responsible").tokenInput(
     [ 
      {id: 7, name: "[email protected]"}, 
      {id: 11, name: "[email protected]"}, 
      {id: 13, name: "[email protected]"}, 
      {id: 17, name: "[email protected]"}, 
      {id: 19, name: "[email protected]"}, 
      {id: 23, name: "[email protected]"}, 
      {id: 29, name: "[email protected]"}, 
      {id: 31, name: "[email protected]"} 
     ],{ 
      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 
     } 
); 
0

Попробуйте это:

$("#responsible").tokenInput(
    [ 
    {id: 7, name: "[email protected]"}, 
    {id: 11, name: "[email protected]"}, 
    {id: 13, name: "[email protected]"}, 
    {id: 17, name: "[email protected]"}, 
    {id: 19, name: "[email protected]"}, 
    {id: 23, name: "[email protected]"}, 
    {id: 29, name: "[email protected]"}, 
    {id: 31, name: "[email protected]"} 
    ],{ 
    prePopulate: respArray, 
    hintText: "Enter mailid", 
    allowFreeTagging: true, 
    theme : "facebook", 
    noResultsText: "O noes", 
    searchingText: "Searching...", 
    minChars: 1, 
    tokenLimit: 1, 
    tokenValue: "name", 
    preventDuplicates: true 
} 
); 

Включите allowFreeTagging: верно, когда вы начинаете.