2013-06-21 29 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. Đầu vào mã thông báo không hoạt động cho mục nhập tùy chỉnh. Ngay khi con trỏ ra khỏi đầu vào, văn bản sẽ biến mất khỏi đầu vào. Làm thế nào tôi có thể giải quyết vấn đề này.
+3

Đối với https://github.com/loopj/jquery-tokeninput 1.6.1 versio, hãy thử allowFreeTagging: true option. – Cindrella

Trả lời

3

Thử nghiệm với @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

Hãy thử điều này:

$("#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 
} 
); 

Bao gồm allowFreeTagging: đúng khi bạn bắt đầu.

Các vấn đề liên quan