I want to create a html form with a text-field which checks if DD-MM-YYYY are correctly entered into the field and alerts the user if it’s not the case. How can i approach this with javascript?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In JS, after the user key’s off or hits enter, you could test the value (assuming the
<input>has an id ofinpdatefor sake of example):I put
\s*in to allow leading and trailing whitespace. Up to you if you would want to allow that.