In Android browser `<input type="password"> I want to set the number input mode when focusing on `

Question: Question:

I am creating a mobile compatible site.

Is there a way to switch Android's input mode to a numeric keyboard when focusing on <input type="password"> ?

I can switch to number input for feature phones ( istyle , format , mode ) and iPhone ( pattern="\d*" ), but only Android doesn't know how to switch to number input.

For Android, other number input fields change <input type="text"> to <input type="number"> so that you can enter numbers, but for the password input field, type="number" If you specify type="number" , masking will be lost, which is inconvenient.

I'm wondering if I can devise another method.

Answer: Answer:

It seems that you can make the numeric keypad appear in the type attribute and mask it with style -webkit-text-security: disc as shown below.

<input type="number" style="-webkit-text-security: disc;">

Since I do not have an Android device at hand, I have not been able to confirm it on Android.

reference:

Scroll to Top