Entrada HTML apenas 4 dígitos
<input type="text" name="pincode" maxlength="4" id="pin" pattern="^0[1-9]|[1-9]\d$" required/>
Tyagi420
<input type="text" name="pincode" maxlength="4" id="pin" pattern="^0[1-9]|[1-9]\d$" required/>
<input type="text"
onkeyup="this.value=this.value.replace(/[^\d]/,'')">