src/jquery-tokeninput/jquery-tokeninput.js
function delete_token (token) {
          // Remove the id from the saved list
          var token_data = $.data(token.get(0), "tokeninput");
          var callback = $(input).data("settings").onDelete;

          var index = token.prevAll().length;
          if(index > selected_token_index) index--;

          // Delete the token
          token.remove();
          selected_token = null;

          // Show the input box and give it focus again
          focus_with_timeout(input_box);

          // Remove this token from the saved list
          saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
          if (saved_tokens.length == 0) {
              input_box.attr("placeholder", settings.placeholder)
          }
          if(index < selected_token_index) selected_token_index--;

          // Update the hidden input
          update_hidden_input(saved_tokens, hidden_input);

          token_count -= 1;

          if($(input).data("settings").tokenLimit !== null) {
              input_box
                  .show()
                  .val("");
              focus_with_timeout(input_box);
          }

          // Execute the onDelete callback if defined
          if($.isFunction(callback)) {
              callback.call(hidden_input,token_data);
          }
      }
function delete_token (token) {
          // Remove the id from the saved list
          var token_data = $.data(token.get(0), "tokeninput");
          var callback = $(input).data("settings").onDelete;

          var index = token.prevAll().length;
          if(index > selected_token_index) index--;

          // Delete the token
          token.remove();
          selected_token = null;

          // Show the input box and give it focus again
          focus_with_timeout(input_box);

          // Remove this token from the saved list
          saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
          if (saved_tokens.length == 0) {
              input_box.attr("placeholder", settings.placeholder)
          }
          if(index < selected_token_index) selected_token_index--;

          // Update the hidden input
          update_hidden_input(saved_tokens, hidden_input);

          token_count -= 1;

          if($(input).data("settings").tokenLimit !== null) {
              input_box
                  .show()
                  .val("");
              focus_with_timeout(input_box);
          }

          // Execute the onDelete callback if defined
          if($.isFunction(callback)) {
              callback.call(hidden_input,token_data);
          }
      }
function delete_token ( token ) { // Remove the id from the saved list var token_data = $ . data ( token . get ( 0 ) , "tokeninput" ) ; var callback = $ ( input ) . data ( "settings" ) . onDelete ; var index = token . prevAll ( ) . length ; if ( index > selected_token_index ) index -- ; // Delete the token token . remove ( ) ; selected_token = null ; // Show the input box and give it focus again focus_with_timeout ( input_box ) ; // Remove this token from the saved list saved_tokens = saved_tokens . slice ( 0 , index ) . concat ( saved_tokens . slice ( index + 1 ) ) ; if ( saved_tokens . length == 0 ) { input_box . attr ( "placeholder" , settings . placeholder ) } if ( index < selected_token_index ) selected_token_index -- ; // Update the hidden input update_hidden_input ( saved_tokens , hidden_input ) ; token_count -= 1 ; if ( $ ( input ) . data ( "settings" ) . tokenLimit !== null ) { input_box . show ( ) . val ( "" ) ; focus_with_timeout ( input_box ) ; } // Execute the onDelete callback if defined if ( $ . isFunction ( callback ) ) { callback . call ( hidden_input , token_data ) ; } }
Delete a token from the token list
Delete a token from the token list