Skip to content

Commit

Permalink
Added callback function for after a token is added to the list.
Browse files Browse the repository at this point in the history
  • Loading branch information
tholder committed Aug 24, 2010
1 parent bc3a890 commit 5d57bb5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/jquery.tokeninput.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ $.fn.tokenInput = function (url, options) {
requireMatch: true, //Added TH - determines if a user should be able to add new tags or must match a selection.
suggestedTagsText: "Suggested tags:",
defaultSuggestTagSize: 14,
defaultSuggestTagSizeUnit: 'px'
defaultSuggestTagSizeUnit: 'px',
afterAdd: function() {}
}, options);

settings.classes = $.extend({
Expand Down Expand Up @@ -93,7 +94,9 @@ $.TokenList = function (input, settings) {

// Create a new text input an attach keyup events
var input_box = $("<input type=\"text\">")
.css({
.attr('id', $(input).attr('id')+'Dynamic')
.attr('name', $(input).attr('id')+'Dynamic')
.css({
outline: "none"
})
.focus(function () {
Expand Down Expand Up @@ -427,6 +430,8 @@ $.TokenList = function (input, settings) {

$.data(this_token.get(0), "tokeninput", {"id": id, "name": value});

settings.afterAdd.call(this);

return this_token;
}

Expand Down

0 comments on commit 5d57bb5

Please sign in to comment.