Browse Source

added showMaskOnFocus option (forgot to commit the actual change)

Robin Herbots 12 years ago
parent
commit
de1f7fe82d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      js/jquery.inputmask.js

+ 2 - 1
js/jquery.inputmask.js

@@ -30,6 +30,7 @@
                 aliases: {}, //aliases definitions => see jquery.inputmask.extensions.js
                 aliases: {}, //aliases definitions => see jquery.inputmask.extensions.js
                 onKeyUp: $.noop, //override to implement autocomplete on certain keys for example
                 onKeyUp: $.noop, //override to implement autocomplete on certain keys for example
                 onKeyDown: $.noop, //override to implement autocomplete on certain keys for example
                 onKeyDown: $.noop, //override to implement autocomplete on certain keys for example
+                showMaskOnFocus: true, //show the mask-placeholder when the input has focus
                 showMaskOnHover: true, //show the mask-placeholder when hovering the empty input
                 showMaskOnHover: true, //show the mask-placeholder when hovering the empty input
                 onKeyValidation: $.noop, //executes on every key-press with the result of isValid
                 onKeyValidation: $.noop, //executes on every key-press with the result of isValid
                 //numeric basic properties
                 //numeric basic properties
@@ -670,7 +671,7 @@
                     }
                     }
                 }).bind("focus.inputmask", function () {
                 }).bind("focus.inputmask", function () {
                     var $input = $(this), input = this, nptValue = input._valueGet();
                     var $input = $(this), input = this, nptValue = input._valueGet();
-                    if (!$input.hasClass('focus.inputmask') && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue == ''))) {
+                    if (opts.showMaskOnFocus && !$input.hasClass('focus.inputmask') && (!opts.showMaskOnHover || (opts.showMaskOnHover && nptValue == ''))) {
                         var nptL = nptValue.length;
                         var nptL = nptValue.length;
                         if (nptL < buffer.length) {
                         if (nptL < buffer.length) {
                             if (nptL == 0)
                             if (nptL == 0)