<form name="form" method="get" action="" >
Number :
<input type="number" name="num" id="num" min="1" max="5" required="required"/> <br/>
Email :
<input type="email" name="email" id="email" required="required"/> <br />
<input type="submit" name="submit" id="submit" value="submit" />
</form>
It is taking alphabets too on submitting the form. No error messages are generated Number type is not working.
This is how you use the input type number in HTML5:
<input type="number" name="cost">
Here is a working example of the input type number.
If you want to add validation try this:
<input type="number" pattern="[0-9]*" name="cost">
Here is a working example of the pattern attribute.
Note: Both the input type number and the pattern attribute have limited browser support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With