15

I want to remove underline from masked input implemented using jQuery inputmask plugin- http://github.com/RobinHerbots/jquery.inputmask enter image description here

nickalchemist
  • 2,211
  • 6
  • 31
  • 58

8 Answers8

19

To remove the mask, use the placeholder option. Assigning an empty string to placeholder, removes the mask. You can assign the placeholder when creating the mask:

$('input').inputmask("mask name", {"placeholder": ""});

Or change it afterwards:

$('input').inputmask({"placeholder": ""});
Ori Drori
  • 183,571
  • 29
  • 224
  • 209
4

You can specify the placeholder (by default _) like this:

$(document).ready(function(){
   $("#date").inputmask("d/m/y",{ "placeholder": "dd/mm/yyyy" });
});

The placeholder can also be a single character, in that case it is repeated for the whole length of your input.

$(document).ready(function(){
   $("#code").inputmask("aaaa",{ "placeholder": "*" });
});

So to remove it you specify an empty placeholder like:

$(document).ready(function(){
   $("#noplaceholder").inputmask("aaaa",{ "placeholder": "" });
});
Niki van Stein
  • 10,564
  • 3
  • 29
  • 62
3

You can also use data-placeholder="" and initialize just like that. Regards

P.D: I'm using Jasny : http://www.jasny.net/bootstrap/javascript/#inputmask-examples

0
$(document).ready(function(){
   $('#code').inputmask({ "placeholder": "" });
   $( "#code" ).focus(function() {
   $('#code').inputmask({ "placeholder": "" });
});
});

If it is showing on focus event as well then try this

Domain
  • 11,562
  • 3
  • 23
  • 44
0

this is my html element

<input dir="ltr" type="tel" name="SecretaryPhone">

and in my jquery

$('input[type="tel"]').mask('(999) 999-9999', { placeholder: "X" });

and the result is what I wanted

enter image description here

but on some versions (I don't know it) the replacment technique is defendant,

you have to put placeholder like this

{ placeholder: "(XXX) XXX-XXXX" }
Basheer AL-MOMANI
  • 14,473
  • 9
  • 96
  • 92
0

Maybe this will help.

When clearMaskOnLostFocus: true is set in the options (default), the mask will clear out the optional part when it is not filled in and this only in case the optional part is at the end of the mask.

For example, given:

$('#test').inputmask('999[-AAA]');

While the field has focus and is blank, users will see the full mask -. When the required part of the mask is filled and the field loses focus, the user will see 123. When both the required and optional parts of the mask are filled out and the field loses focus, the user will see 123-ABC.

This is in the documentation here.

Here's an example:

        $("#whatever").inputmask("a{0,4}", {
            clearMaskOnLostFocus: true
        });
0

You can remove default mask value that corresponds to "_" on module code.

Path: /node_modules/react-input-mask/lib/react-input-mask.development.js (file react-input-mask.production.min.js too)

change var defaultMaskChar = "_" to: var defaultMaskChar = ""

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
Railson
  • 1
  • 1
0

add those 3 options

placeholder: ' ',
showMaskOnHover: false,
showMaskOnFocus: false

like here:

var inputmask = new Inputmask({
        mask: ["9{1,3}-A{1,2}-9{1,2}", "A{1,2}-9{1,3}-A{1,2}"],
        keepStatic: true,
        placeholder: ' ',
          showMaskOnHover: false,
          showMaskOnFocus: false
    });
    inputmask.mask($('#carteGriseImmatriculation'));
Nejmeddine Jammeli
  • 1,011
  • 9
  • 17