Skip to content

Commit

Permalink
Fire a change event from the original input every time a user action …
Browse files Browse the repository at this point in the history
…happens, so that a change listener can be added to the original element
  • Loading branch information
manuelbernhardt committed Jul 28, 2011
1 parent fbced43 commit 394b9c8
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 394b9c8

Please sign in to comment.