Set a date for a date field:
The value property sets or returns the value of the value attribute of a date field.
The value attribute specifies a date for the date field.
The value property is supported in all major browsers.
Note: The <input type="date"> element is not supported in Internet Explorer or Firefox.
Return the value property:
Set the value property:
Value | Description |
---|---|
YYYY-MM-DD |
Specifies a date for the date field. Explanation of components:
|
Return Value: | A String, representing the date of the date field |
---|
Get the date of a date field:
The result of x will be:
An example that shows the difference between the defaultValue and value property:
HTML reference: HTML <input> value attribute