The js control text box can only contain Chinese characters, English letters, numbers, and specified special characters.

Source: Internet
Author: User

The js control text box can only contain Chinese characters, English letters, numbers, and specified special characters.
Only numbers can be entered in the JS control text box.


Javascript control text box can only enter numbers, decimal points


Javascript control text box can only be entered in English


Only English and numbers can be entered in the JS control text box.


The JS control text box can only enter Chinese Characters


The JS control text box can only contain Chinese characters, English letters, and numbers.


The JS control text box can only contain Chinese characters, English letters, numbers, and spaces.


The javascript control text box can only contain Chinese characters, English letters, numbers, and decimal places.


All in all:

First in''

Onkeyup = "value = value. replace (/[^ \ X]/g ,'')"

Then replace X in (/[\ X]/g, '') with the code you want to enter,

Chinese u4E00-u9FA5, number 0-9, English a-z \ A-Z, other symbols @, point or other symbols.

You can also use \ To separate multiple.
Example: Chinese and English + number + @ symbol + dot symbol \ A-\ z \ A-\ Z0-9 \ u4E00-\ u9FA5 \@\.

If you do not want to right-click the menu in the text box or paste the copied information

In''Enter onpaste = "return false" oncontextmenu = "return false ;"


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.