input-masking icon indicating copy to clipboard operation
input-masking copied to clipboard

Initial Values Added to Masked Text Box Placeholder Overlayed

Open ZoomPicard opened this issue 5 years ago • 3 comments

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);
    }

   ....

  }

ZoomPicard avatar Mar 07 '19 05:03 ZoomPicard

I made a proper fix in this pull request: https://github.com/estelle/input-masking/pull/16

whitespacecode avatar Jul 18 '19 14:07 whitespacecode

Thank you

ZoomPicard avatar Jul 18 '19 15:07 ZoomPicard

I just masked initial text in the filed at activateMasking t.dispatchEvent(new Event("input", { bubbles: false, cancelable: false }));

Auer111 avatar Aug 25 '20 22:08 Auer111