davosandoval
davosandoval

Reputation: 23

Numbers only in a password with JQuery Mobile

I am writing because I have a problem with the input type password.

The problem is that I want only numbers in password. It means iPhones should enable the numeric keyboard, not the complete keyboard with letters. I've tried for look an answer for this question, but I've not found any solution. Thanks in advance.

Upvotes: 0

Views: 1929

Answers (1)

Adam Hopkinson
Adam Hopkinson

Reputation: 28795

Try adding _zip or _phone to the end of your input name - iOS should see it as requiring the numeric keyboard. Not sure if this works with a type="password" field, you'll have to try.

<input type="string" name="tel_phone" />
<input type="password" name="pass_zip" />

Update

As per the link in Matt's comment, the best way to specify the numeric keyboard is to use type="number" - but that won't occlude the entry like a password field would. It's up to you!

Upvotes: 1

Related Questions