why data-inputmask is not working : npmjs

313 views Asked by At

I am trying to apply phone number masking. I followed this Documentation and did everything but still, phone masking is not working.

enter image description here

Below is the code.

var template = '\
<div class="contactItem">\
                    <label style="padding:6px" >Home phone</label>\
                    <input class="form-control" type="text" data-inputmask="\'mask\': \'999-99-9999\'" /> \
                    </div>\
                </div>\
';

self.dialog = puDialogV2.showDialog($('.body-content'), 'Add Contact', template, self, self.addContact, self.cancelSaveContact);

1

There are 1 answers

0
burkay On

Looks like you are following the "via data-inputmask attribute" option in documentation. Most probably you are missing the second part of it. Try adding below code to your javascript part.

$(document).ready(function(){
  // $(":input").inputmask();
  // or
  Inputmask().mask(document.querySelectorAll("input"));
});