I have this script in js:
CODE HTML:
<input class="required-input" type="text" name="date_of_birth" id="date_of_birth" placeholder="MM/DD/YYYY">
CODE JS:
$('.required-input').each(function() {
$(this).on('input keyup keypress blur change', function() {
const dob= /^([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0]?[1-9]|[1][0-2])[./-]([0-9]{4}|[0-9]{2})$/;
var regex;
if ($(this).attr("id") == "date_of_birth")
{
regex = dob;
}
//SOME CODE JS:
});
});
I want these things:
1.To be the next format 23/09/1992
2.You can not write more characters than necessary.
3.You can not write letters, only numbers
How to change this variable (dob)
to be good?
Thanks in advance!