jqueryjquery-mask

How to apply data-jqmask to a textbox using jQuery


I'm trying to change the masked input of a text box using jQuery, using below code to change the attribute, but in output, I can see the only textbox without masked input like 111111111111111111111111, I want the output in the textbox like (000) 000-0000 0000000000, how can I achieve this

self.htmlFields.TXT_CONTACTNUMBER.attr('maxlength', '25');
self.htmlFields.TXT_CONTACTNUMBER.attr('data-jqmask', '(000) 000-0000 0000000000');

Solution

  • just updated the below code to get required output

    self.htmlFields.TXT_CONTACTNUMBER.mask('(000) 000-0000 0000000000');