Home > Article > Web Front-end > Summary of js character type methods for controlling text box input_javascript skills
JS control text box can only input numbers
JS control text box can only input numbers and decimal points
First enter
in ‘’
onkeyup="value=value.replace(/[^X]/g,'')"Then replace the X in (/[X]/g,'') with the code you want to enter,
Chinese u4E00-u9FA5, numbers 0-9, English a-zA-Z, other symbols @, dot or other symbols.
You can also have more than one, just separate them.
For example: Chinese and English numbers @symbol dot symbol a-zA-Z0-9u4E00-u9FA5@.
Just enter onpaste="return false" oncontextmenu="return false;" in ''