I am creating a form that will allow a user to enter a birthday with month, day and year. For year, I am trying to write the html code such that it will only allow positive number and also limit it to 4 digits. Here is the code in question:
<input type="number" name="year" maxlength="4" max="9999" min="0" step="1" placeholder="YYYY" p="[0-9]{4}" style="color:#888;" required/>
I've scoured the web for a solution to what I am trying to do but every time I try it, it will allow me to enter a number that is greater than 4 digits... basically I am trying to limit the user to enter a valid birth year:
Any advice?? thanks in advance!!