RobinHerbots / Inputmask

Input Mask plugin

Home Page:https://robinherbots.github.io/Inputmask/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How to custom placeholder in "ip" alias?

KiddoV opened this issue · comments

commented

I am trying to make the place holder look like this "___.___.___.___", but no matter what I do, it's still showing "_._._._".
Is anyone know how to fix that?

import Inputmask from 'inputmask';

const ipv4Inputs = document.querySelectorAll("input[type='ipv4']");
ipv4Inputs.forEach((input: HTMLInputElement) => {
    Inputmask({alias: "ip", greedy: false, placeholder: "___.___.___.___", clearIncomplete: true}).mask(input);
});

I have tried placeholder: "___.___.___.___", but it doesn't work.

Thanks,

Have you tried with greedy: true?

commented

Thanks, it works, but the behavior is not what I expected. When you type a 2 digit number like "99", it doesn't automatically jump to the next IP section anymore:

99_.___.___.___

You have to type 99 then space. Without greedy, it would automatically jump to the next section if you type a number that bigger than 255, so when I type 99999999 without space it would mask 99.99.99.99. Now, it just stop when I keep type 9.

@KiddoV ,

Hmm yes, that would be a good enhancement. 999 is an impossible value so it should jump to the next section.

commented

In the meantime, is there any work around for this you can suggest?

It is fixed in version 5.0.9-beta.35

Correction, almost fixed, .... I just discovered an issue. Anyway you can already have look on the demo page.

commented

Thanks for the update!

It is fixed in version 5.0.9-beta.36