Browse Source

Another focus fix

Robin Herbots 14 years ago
parent
commit
f9e41bc211
1 changed files with 3 additions and 3 deletions
  1. 3 3
      jquery.inputmask.js

+ 3 - 3
jquery.inputmask.js

@@ -560,11 +560,11 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
 
 
                 setTimeout(function() {
                 setTimeout(function() {
                     lastPosition = checkVal(input, buffer, true);
                     lastPosition = checkVal(input, buffer, true);
-                    if (opts.clearMaskOnLostFocus && _val.call(input) == _buffer.join(''))
-                        _val.call(input, '');
                     if(document.activeElement === input[0]) { //position the caret when in focus
                     if(document.activeElement === input[0]) { //position the caret when in focus
+                    	input.addClass('focus.inputmask');
                     	caret(input, lastPosition);
                     	caret(input, lastPosition);
-                    }
+                    } else if (opts.clearMaskOnLostFocus && _val.call(input) == _buffer.join(''))
+                        _val.call(input, '');
                 }, 0);
                 }, 0);
 
 
                 //private functions
                 //private functions