Explanation of the above example
- The event.preventDefault() helps in restricting the user to give the input if the input does not match the numeric values based on the ASCII table.
The ASCII table is shown below for your reference.
Conclusion:- I hope the above illustration will help you to understand the overview. If there is any doubt then please leave a comment below.