How to set default value for datetime field in HTML 5?

Posted by Sheonarayan under HTML 5 category on | Points: 40 | Views : 1884
Setting default value of datetime input field is tricky in HTML 5.

If we specify value attribute to "MM/dd/yyyy", it doesn't work so we need to set the default value to "yyyy-MM-dd" like below.

<input type="datetime" name="BirthDate" value="2015-04-12" />.

This brings the BirthDate text box with default value as 12 April 2015.

Hope this helps.


Comments or Responses

Login to post response