Skip to content

Commit

Permalink
Merge branch 'autocompleteselected_callback'
Browse files Browse the repository at this point in the history
  • Loading branch information
cleishm committed Oct 7, 2011
2 parents 8b01480 + aeadea5 commit 824e9db
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions js/tag-it.js
Expand Up @@ -80,7 +80,9 @@
// Event callbacks.
onTagAdded : null,
onTagRemoved: null,
onTagClicked: null
onTagClicked: null,

onAutocompleteSelected: null
},


Expand Down Expand Up @@ -238,8 +240,12 @@
if (that._tagInput.val() === '') {
that.removeTag(that._lastTag(), false);
}
that.createTag(ui.item.value);
var tag = that.createTag(ui.item.value);
// Preventing the tag input to be updated with the chosen value.
that._trigger('onAutocompleteSelected', event, {
item: ui.item,
tag: tag
});
return false;
}
});
Expand Down Expand Up @@ -370,9 +376,9 @@
this._tagInput.val('');

// insert tag
this._tagInput.parent().before(tag);
return tag.insertBefore(this._tagInput.parent());
},

removeTag: function(tag, animate) {
animate = animate || this.options.animate;

Expand Down

0 comments on commit 824e9db

Please sign in to comment.