<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]/,'')">