input-masking
input-masking copied to clipboard
Initial Values Added to Masked Text Box Placeholder Overlayed
Loading in an initial value into a text box with the library enabled will mean the placeholder is drawn under the text.
I tried to call various events to fix this issue but found a small change to the code based worked by hiding the placeholder if there is already a value in the text box:
createShell : function (t) {
....
mask.appendChild(emphasis);
//Don't add placeholder if data already exists
if (t.value.length == 0) {
mask.appendChild(placeholder);
}
....
}
I made a proper fix in this pull request: https://github.com/estelle/input-masking/pull/16
Thank you
I just masked initial text in the filed at activateMasking t.dispatchEvent(new Event("input", { bubbles: false, cancelable: false }));