Easy Tutorial
❮ Event Onmouseup Prop Style Backgroundsize ❯

Input Datetime required Attribute

Input Datetime Object

Example

Check if the datetime field is required before submitting the form:


Definition and Usage

The required attribute is used to set or return whether the datetime field is mandatory in the form.

This attribute reflects the HTML required attribute.


Browser Support

All major browsers support the required attribute, except Internet Explorer 9 and earlier versions, and Safari.

Note: Internet Explorer, Firefox, Opera 15 (and later versions), or Chrome support the <input> element with type="datetime".


Syntax

Return the required attribute:

Set the required attribute:

Attribute Values

Value Description
true|false Describes whether the datetime field is required before form submission. true - The datetime field is mandatory for the form. false - Default. The datetime field is optional for the form.

Technical Details

| Return Value: | Boolean, returns true if the datetime field is mandatory for the form, otherwise returns false. | | --- | --- |


More Examples

Example

Set the datetime field as mandatory for the form:


Related Pages

HTML Reference: HTML <input> required Attribute


❮ Event Onmouseup Prop Style Backgroundsize ❯