Answers for "limit input in html only accept digits"

1

simple way to make a text field to accept numbers only with maximum number of length 13 digit and min 10

<input name="phoneNumber"
    oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
    type = "number"
    maxlength = "10"
 />
Posted by: Guest on December-23-2020
-1

html input only 4 digits

<input type="text"  name="pincode" maxlength="4"  id="pin" pattern="^0[1-9]|[1-9]\d$" required/>
Posted by: Guest on June-04-2021

Code answers related to "limit input in html only accept digits"

Browse Popular Code Answers by Language