Permalink
Browse files

fixed the autoclear issue

  • Loading branch information...
1 parent 9ed9d2b commit aec37abc62a4d8ddd5cf885bd387dadd1d2622f3 Mohnish Thallavajhula committed May 8, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/jquery.maskedinput.js
View
@@ -55,7 +55,8 @@
}
settings = $.extend({
placeholder: "_",
- completed: null
+ completed: null,
+ autoclear: false
}, settings);
var defs = $.mask.definitions;
@@ -230,7 +231,9 @@
})
.bind("focus.mask", function() {
focusText = input.val();
- var pos = checkVal();
+ if(setting.autoclear) {
+ var pos = checkVal();
+ }
writeBuffer();
var moveCaret=function(){
if (pos == mask.length)
@@ -241,9 +244,13 @@
($.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)

0 comments on commit aec37ab

Please sign in to comment.