Home > Web Front-end > JS Tutorial > body text

Use js regular to control the input tag to only allow input values ​​_javascript skills

WBOY
Release: 2016-05-16 17:27:58
Original
1288 people have browsed it

style="ime-mode:Disabled"
This sentence is more practical. It means to close the input method. This will save some people from crying to you when they input numbers with full-width settings, but they can’t input them, blaming your poor design.

Only numbers are allowed

Copy code The code is as follows:

< input name="username" type="text" onkeyup="value=this.value.replace(//D /g,'')">

Only English letters and numbers are allowed to be entered and underline (implemented by the following two methods)
Copy code The code is as follows:




Only English letters, numbers and &=@ are allowed to be entered
Copy the code The code is as follows:



Only Chinese characters are allowed
Copy code The code is as follows:



Example: Limit the input of three digits to numbers or '.' and turn off the input method in the input
Copy code The code is as follows:

Discount




Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template