问题
in this link: http://jquerymobile.com/demos/1.2.0/docs/forms/textinputs/ at the bottom there are several different text input types.
Now my question is how could I combine the tel and password types? The tel types enables the user to display the number pad (key pad) on the mobile device if that type receives focus instead of showing the regular keyboard. The password type hides the characters that the user types. Since the password on my webpage will only consists of digits it would be nice if I could combine the functionality of the tel type and password type.
回答1:
You can use pattern="[0-9]*" attribute to achieve this:
<input type="password" name="password" pattern="[0-9]*" id="password" value="" placeholder="Enter your numeric password">
It totally works on iOS.
来源:https://stackoverflow.com/questions/14328983/combine-text-input-types-jquery-mobile