Question and answer is powered by AnsPress.io
In HTML max length not working for input type number. I am following this code:
My HTML:
<input type="number" name="price" required="required" class="form-control col-md-7 col-xs-12" maxlength="2">
Apply it
<input type="number" class="form-control col-md-7 col-xs-12" name="price" pattern="/^-?\d+\.?\d*$/" onKeyPress="if(this.value.length==2) return false;" />