JS control text box can only enter numbers
<input onkeyup="value=value.replace(/[^0-9]/g,'')"onpaste="value=value.replace(/[^0-9]/g,'')" oncontextmenu ="value=value.replace(/[^0-9]/g,'')">
JS controls text boxes to enter only numbers and decimal points
<inputonkeyup="value=value.replace(/[^/0-9/.]/g,'')"onpaste="value=value.replace(/[^/0-9/.]/g,'')" oncontextmenu ="value=value.replace(/[^/0-9/.]/g,'')">
JS control text box can only enter English
<inputonkeyup="value=value.replace(/[^/a-/z/A-/Z]/g,'')"onpaste="value=value.replace(/[^/a-/z/A-/Z]/g,'')" oncontextmenu ="value=value.replace(/[^/a-/z/A-/Z]/g,'')">
JS control text boxes can only enter English and numbers
<inputonkeyup="value=value.replace(/[^/a-/z/A-/Z0-9]/g,'')"onpaste="value=value.replace(/[^/a-/z/A-/Z0-9]/g,'')">
JS control text boxes can only enter Chinese
<inputonkeyup="value=value.replace(/[^/u4E00-/u9FA5]/g,'')"onpaste="value=value.replace(/[^/u4E00-/u9FA5]/g,'')" oncontextmenu="value=value.replace(/[^/u4E00-/u9FA5]/g,'')">
JS control text boxes can only enter Chinese, English, and numbers
<inputonkeyup="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5]/g,'')"onpaste="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5]/g,'')">
JS control text boxes can only enter Chinese, English, numbers, and spaces
<inputonkeyup="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5/]/g,'')"onpaste="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5/]/g,'')">
JS control text boxes can only enter Chinese, English, numbers, and decimal points.
<inputonkeyup="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5/.]/g,'')"onpaste="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5/.]/g,'')">
all in all:
First enter in '<input>'
onkeyup="value=value.replace(/[^/X]/g,'')"
Then change the X in (/[/X]/g,'') to the code you want to enter.
Chinese u4E00-u9FA5, numbers 0-9, English az/AZ, other symbols @, dots or other symbols.
It can also be multiple, just use/separate it.
For example: Chinese and English + numbers + @ symbol + dot symbol /a-/z/A-/Z0-9/u4E00-/u9FA5/@/.
If you want to right-click the menu and cannot paste copy information in the text box
You need to enter onpaste="return false" oncontextmenu="return false;" in '<input>'
The above js control text box can only enter the implementation code of Chinese, English, numbers and specified special symbols. This is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.