Skip to content

Commit

Permalink
change callback is now independent of the change event - fixes #157
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Apr 4, 2013
1 parent 048590c commit bac1ad4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/jquery.keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ $.keyboard = function(el, options){
base.temp = [ '', 0, 0 ]; // used when building the keyboard - [keyset element, row, index]

// Bind events
$.each('initialized beforeVisible visible change hidden canceled accepted beforeClose'.split(' '), function(i,f){
$.each('initialized beforeVisible visible hidden canceled accepted beforeClose'.split(' '), function(i,f){
if ($.isFunction(o[f])){
base.$el.bind(f + '.keyboard', o[f]);
}
Expand Down Expand Up @@ -385,6 +385,9 @@ $.keyboard = function(el, options){
}, 100);

base.checkMaxLength();
// change callback is no longer bound to the input element as the callback could be
// called during an external change event with all the necessary parameters (issue #157)
if ($.isFunction(o.change)){ o.change( $.Event("change"), base, base.el ); }
base.$el.trigger( 'change.keyboard', [ base, base.el ] );
})
.bind('keydown.keyboard', function(e){
Expand Down Expand Up @@ -466,6 +469,7 @@ $.keyboard = function(el, options){
}
base.checkCombos();
base.checkMaxLength();
if ($.isFunction(o.change)){ o.change( $.Event("change"), base, base.el ); }
base.$el.trigger( 'change.keyboard', [ base, base.el ] );
base.$preview.focus();
// attempt to fix issue #131
Expand Down

0 comments on commit bac1ad4

Please sign in to comment.