The regular expression limits that only numbers can be entered in the input box. CodeAs follows:
<Input type = "text" on Keyup = "This. value = This. value. Replace (/[^ \ D]/g,'') "on Afterpaste = "This. value = This. value. Replace (/[^ \ D]/g,'') "name =" f_order "value =" 1 "/>
Where, onAfterpaste prevents users from copying content from other places to the input box
You can only enter regular expressions for letters and hyphens in the input box.
<Input onKeyup = "This. value = This. value. Replace (/[^ _ A-Za-Z]/g,'') "onPaste = "This. value = This. value. Replace (/[^ _ A-Za-Z]/g,'') ">
The input box can only contain letters, numbers, and regular expressions on the lower horizontal line.
<Input onKeyup = "This. value = This. value. Replace (/[^ \ W]/g,'') "onPaste = "This. value = This. value. Replace (/[^ \ W]/g,'') ">
Or
<Input onKeyup = "This. value = This. value. Replace (/[\ W]/g,'') "onPaste = "This. value = This. value. Replace (/[\ W]/g,'') ">