我试图限制HTML文本框中的用户只插入4位数字0-9.
我尝试了如下,但它仅限于允许两位数字.
<input type="text" name="pincode" maxlength="4" id="pin" pattern="^0[1-9]|[1-9]\d$" required/>
html regex
html ×1
regex ×1