diff --git a/src/jquery.maskedinput.js b/src/jquery.maskedinput.js index af67604..1e05de7 100644 --- a/src/jquery.maskedinput.js +++ b/src/jquery.maskedinput.js @@ -55,7 +55,8 @@ } settings = $.extend({ placeholder: "_", - completed: null + completed: null, + autoclear: true }, settings); var defs = $.mask.definitions; @@ -230,7 +231,9 @@ }) .bind("focus.mask", function() { focusText = input.val(); - var pos = checkVal(); + if (settings.autoclear) { + var pos = checkVal(); + } writeBuffer(); var moveCaret=function(){ if (pos == mask.length) @@ -241,9 +244,11 @@ ($.browser.msie ? moveCaret:function(){setTimeout(moveCaret,0)})(); }) .bind("blur.mask", function() { - checkVal(); - if (input.val() != focusText) - input.change(); + if (settings.autoclear) { + checkVal(); + if (input.val() != focusText) + input.change(); + } }) .bind("keydown.mask", keydownEvent) .bind("keypress.mask", keypressEvent) @@ -255,4 +260,4 @@ }); } }); -})(jQuery); +})(jQuery); \ No newline at end of file