Home >Web Front-end >H5 Tutorial >On a mobile HTML5 page, the input type is number and the length cannot be controlled, and ugly plus and minus buttons are displayed on the right.

On a mobile HTML5 page, the input type is number and the length cannot be controlled, and ugly plus and minus buttons are displayed on the right.

黄舟
黄舟Original
2017-02-09 15:53:352921browse

Scenario:

This is a problem I encountered when moving web controls before. At that time, we needed to enter card number, CV2, mobile phone number, verification code and other information on the HTML5 page of our control. Everyone knows that these values ​​are numbers. When we click on the ordinary input box, the keyboard that pops up by default on the phone only has letters and symbols, but here we only need to enter numbers, and we only need to switch to the numeric keyboard. Later, we adopted a number type input box. Although it can lift the number

keyboard of the mobile phone, some mobile phones will display increase and decrease buttons. At the same time, some mobile phones do not support it, such as Hammer phones. The most important thing is There is no way to limit the length of the input.

Later, in the next version of our control, we tested various types of input boxes in Html5, and finally found the following types of input boxes to meet our requirements.

Resolution:

# This can change the Type of the input box from Number to Tel, which not only can limit the length of the input string Keyboard, and there will be no ugly style like number type.

The above is the content of the mobile HTML5 page input type using number, which cannot control the length, and the ugly plus and minus buttons displayed on the right. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn