Questions tagged [jquery-mask]

jQuery Mask is a jQuery Plugin used to make masks on form fields and HTML elements.

jQuery Mask is a jQuery based Plugin used to make masks on form fields and HTML elements.

Usage

// Applies the mask to the matching selector elements.
$(selector).mask(mask [, options]);

// Seek and destroy selector elements to be masked.
$(selector).unmask();

// Gets the value of the field without the mask.
$(selector).cleanVal();

// Applies the mask to the matching selector elements.
$.applyDataMask([selector]);

Resource

74 questions
23
votes
3 answers

Why does jQuery mask say it's not a function?

When trying to use the jQuery mask() function, I get the following error in the console: TypeError: $(...).mask is not a function This is a sample of my code where this is happening:
Jack
  • 16,276
  • 55
  • 159
  • 284
14
votes
3 answers

Jquery Mask number with commas and decimal

I am using a Jquery mask plugin to format many things on my site and I am trying to figure out how to get it to format numbers in the way I need. I am using the following plugin. https://igorescobar.github.io/jQuery-Mask-Plugin/ I am attempting to…
James
  • 702
  • 2
  • 15
  • 39
9
votes
3 answers

jQuery Masked Input - Existing Input Value

I am using jQuery masked input plugin. However when I set the mask, any existing value in the input field is being destroyed. Doing the following: $(".priceSKUID").mask("**-***-******", { placeholder: " " }); There must be a way to deal with…
plippard
  • 375
  • 2
  • 3
  • 17
9
votes
2 answers

jQuery-Mask-Plugin to mask email addresses and web URL's

I'm using the jQuery-Mask-Plugin in my application and using that I was able to successfully add masks to telephone numbers, date time .. etc. $("#date").mask("99/99/9999",{placeholder:"mm/dd/yyyy"}); $("#phone").mask("(999) 999-9999"); But I…
prime
  • 14,464
  • 14
  • 99
  • 131
9
votes
1 answer

Jquery masked Input v1.4 issue with Samsung Android device

I'm facing an issue with jquery-masked-input v1.4 plugin. I have a input field: and have applied the mask to it: It…
Abhishek
  • 1,974
  • 5
  • 31
  • 67
7
votes
1 answer

How can I fix the character 'A' in a JQuery-mask?

I've been building a zip code component in ASP.NET MVC which will be globalized. Which means that according the supplier's country, the textbox will set the correct zip code's mask. The problem is that some countries have a 'A' character fixed in…
7
votes
2 answers

jquery masked input have only first number optional rest mandatory

Im using jquery masked input plugin and need to have a phone field with the following format: 1 (222) - 000 - 1114 my code looks like this: $("#myPhone").mask("9 (999) - 999 - 9999"); now i cant seem to get it to work to make the first digit…
GGio
  • 7,563
  • 11
  • 44
  • 81
6
votes
1 answer

Masked inputs with PhoneGap on Android

I'm using jQuery Mobile + PhoneGap to build my first mobile app and I need to apply masks. For that I'm trying to use jQuery's Masked Input plugin, which I'd used on desktop browsers and just works. But Android's 4.0 browser used on…
Paulo Freitas
  • 13,194
  • 14
  • 74
  • 96
5
votes
5 answers

jQuery Mask Plugin: mask for negative integers

I am using jQuery Mask Plugin in my web project. It is used widely and I don't want to change it for now. I use the following mask for the numbers with decimal separators: For example for the element: I…
baldr
  • 2,891
  • 11
  • 43
  • 61
5
votes
0 answers

jQuery mask plugin currency

For my project I'm using jQuery-Mask-Plugin. On the site of this plugin there is an example for currency / money. $('.money').mask('000.000.000.000.000,00', {reverse: true}); $('.money2').mask("#.##0,00", {reverse: true, maxlength: false}); This is…
A1rPun
  • 16,287
  • 7
  • 57
  • 90
3
votes
2 answers

Use react ref as selector for jquery

How to use React Ref together with jQuery lib without specified id to the input? import $ from 'jquery'; import 'jquery.mask.js'; class PhoneComponent extends React.Component { ref = React.createRef(); state = {value: ''}; …
Alexey Nikonov
  • 4,958
  • 5
  • 39
  • 66
3
votes
0 answers

Validating mask input date in jquery while entering date

I am using jquery mask plugin for date entry in textbox and the date format is MM/DD/YYYY. I want to do the validation while entering the date. Suppose if I enter month as 13 at that time it should alert me month is invalid, like that I need to do…
vinu natesh
  • 173
  • 2
  • 11
3
votes
1 answer

How to perform multiple masks on demand on an Input field

Iam trying to perform a mask on input using jquery mask plugin, What I need to do is to perform two different masks: US###-###-###-###-###-### this mask must be applied if the user is trying to type some numbers at first. (Which here I mean digit…
user435245
  • 859
  • 4
  • 16
  • 28
3
votes
0 answers

Jquery with mask plugin not working on Chrome

Im using Jquery Mask Plugin: http://plugins.jquery.com/mask/ My script: