Simply you can add your Html forms in the input field like this:
...onkeypress ="return /[a-z .@ 0-9]/i.test(event.key)" required accesskey="4"
You don't need any function. This Validation works only with the email
field. Don't use naming or number. To use number, remove email regular expression like this:
...onkeypress ="return /[a-z ]/i.test(event.key)" required accesskey="4"
For number only:
...onkeypress ="return /[0-9]/i.test(event.key)" required accesskey="4"
Don't forget, to add for each input fields their own value.
<div class="form-group">
<input type="Email" class="form-control " id="EMAILADDRESS" name="EMAILADDRESS" placeholder="Email Address" autocomplete="false" onkeypress ="return /[a-z .@ 0-9]/i.test(event.key)" required accesskey="4"/>
</div>
keycode
andwhich
are deprecated and its suggested to useKeyboardEvent.key
– Verdin