简体   繁体   中英

inputmask not working when input clicked

I have included the inputmask js files correctly and can see it in my source.

in my app.js I have the following along with my HTML in my view however I am getting nothing when I click the input why?

JS:

$(document).ready(function(){
  $(":input").inputmask();
});

HTML:

<div class="form-group">
                <label class="col-sm-2 control-label" for=
                "dob">D.O.B</label>

                <div class="col-sm-10">
                    <input class="form-control" data-inputmask=
                    "'alias': 'dd/mm/yyyy'" type="text">
                </div>
        </div>

Wrap it in a click function?

$(document).ready(function(){
  $(".form-group > div > input").on('click', function(){
     $(this).inputmask();
  });
});

OR

$(document).ready(function(){
  $(".form-group > div > input").on('click', inputmask());
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM