Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request loopj#140 from manuelbernhardt/change-event-patch
Fire a change event from the original input every time a user action takes place
  • Loading branch information
loopj committed Jul 28, 2011
2 parents fbced43 + 394b9c8 commit 921fa8f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/jquery.tokeninput.js
Expand Up @@ -230,6 +230,7 @@ $.TokenList = function (input, url_or_data, settings) {
if(!$(this).val().length) {
if(selected_token) {
delete_token($(selected_token));
hidden_input.change();
} else if(previous_token.length) {
select_token($(previous_token.get(0)));
}
Expand All @@ -249,6 +250,7 @@ $.TokenList = function (input, url_or_data, settings) {
case KEY.COMMA:
if(selected_dropdown_item) {
add_token($(selected_dropdown_item).data("tokeninput"));
hidden_input.change();
return false;
}
break;
Expand Down Expand Up @@ -434,6 +436,7 @@ $.TokenList = function (input, url_or_data, settings) {
.appendTo(this_token)
.click(function () {
delete_token($(this).parent());
hidden_input.change();
return false;
});

Expand Down Expand Up @@ -636,6 +639,7 @@ $.TokenList = function (input, url_or_data, settings) {
})
.mousedown(function (event) {
add_token($(event.target).closest("li").data("tokeninput"));
hidden_input.change();
return false;
})
.hide();
Expand Down

0 comments on commit 921fa8f

Please sign in to comment.