igorescobar / jQuery-Mask-Plugin

A jQuery Plugin to make masks on form fields and HTML elements.
http://igorescobar.github.io/jQuery-Mask-Plugin/
Other
4.77k stars 1.42k forks source link

Does not mask pre-loaded input #735

Open barrychapman opened 4 years ago

barrychapman commented 4 years ago

Have you take a look into our docs?

yeah

Device

[Win10]

Browser (and version)?

Chrome|Firefox

Functional jsfiddle exemplifying your problem:

https://jsfiddle.net/barrychapman/L584kupw/6/

Describe de problem depth:

The issue is that when a value exists in an input field (such as editing an existing record), it does not parse it properly.

It should really perform a RegEx replace against the mask that has been defined.

So in my case, my mask consists of integers - (999) 999-9999

All characters -except- for integers should be removed, and then the mask should be applied to the raw integers. Otherwise you end up with offsets like you see in the fiddle.

Is this plugin helping you out? Buy me a beer and cheers! :beer: sort of :)

:bowtie: https://www.paypal.me/igorcescobar

shayckspear commented 4 years ago

You need characters "-"? if not remove, mask will work fine

ganix33 commented 4 years ago

Just remove mask characters from the value. In your sample in jsfiddle replace 248-425-865 with 2484258651.