Input type number in html 5 not working?
<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 also accepts alphabets when submitting forms. Error messages are not generated. Number type does not work.
So you use the input type number in HTML5:
<input type="number" name="cost"> Here is an example of an input type number operation.
If you want to add confirmation, try the following:
<input type="number" pattern="[0-9]*" name="cost"> Here is a working example of an attribute.
Note: Both types of input are type and have limited browser support.