I am required to create a form using HTML5 that has this validation;
Date of birth should be a valid date in the format dd/mm/yyyy. After entering the DOB, the page should calculate the age and alert the user if he/she is under 18 with the message “You must be over 18 to register”
Could anyone please make my understand how I code create this validation? The could below is how my form looks like.
<div id="content">
    <article id="contentimg">
        <form action="http://posttestserver.com/post.php" onsubmit="return validate_form(this)" method="post">
        <fieldset style="border: 1px solid; padding: 10px;">
            <legend>Enter your information to subscirbe:</legend>
            First name: <input class="glowing-border" type="text" name="firstname" required><br>
            Last name: <input class="glowing-border" type="text" name="lastname" required><br>
            Birthday: <input class="glowing-border" type="date" name="bday"><br>
            Address: <input class="glowing-border2" type="text" name="address"><br>
            Mobile Number: <input class="glowing-border" type="text" name="mobno"><br>
            Email: <input id="email" class="glowing-border" type="email" name="email" required pattern="[a-zA-Z]{3,}@[a-zA-Z]{3,}[.]{1}[a-zA-Z]{2,}"><br>
            Confirm Email: <input id="confemail" class="glowing-border" type="email" name="email" required pattern="[a-zA-Z]{3,}@[a-zA-Z]{3,}[.]{1}[a-zA-Z]{2,}" 
            onfocus="validateMail(document.getElementById('email'), this);" oninput="validateMail(document.getElementById('email'), this);"><br>
            <input class="glowing-border" type="submit" value="Submit">
            <input class="glowing-border" type="reset" value="Reset">
        </fieldset>
        </form>
    </article>
</div>
 
     
    