• Register
100 points
3


In this article we are going to discuss, how to code in HTML for adding date of birth in registration form. Now we will use form attribute for adding input tag of date of birth. So users can enter their date of birth in the registration form. 

Approach

We can add option for filling date of birth for users as follows, firstly we need to create a form attribute and also need to create an input tag like this <input> elements of type=”date” and next we will create an input field that allows the user to enter a date which is definitely user’s date of birth, either with a textbox that validates the input or a special date picker for the user. The resulting value will include the year, month and day, but remember not the time. Because the input type=”date” does not support time.


Here is an example which can give you a better understanding for adding date of birth in the registration form.


Program
 


<html>  
<head>

  <title> HTML input type date </title>

</head>

<body>

  <form>

        Select date of birth : <input type="date"><br>

  </form>

</body>

</html>

Output

image

Hope this will help.

100 points
3