Input DatetimeLocal required attribute
Definition and Usage
required
Sets or returns whether the local date and time field must be filled out before submitting the form.
This property reflects the HTML required attribute.
See also:
HTML Reference Manual:Atributo required del <input> en HTML
Example
Example 1
Determine whether the local date and time field must be filled out before submitting the form:
var x = document.getElementById("myLocalDate").required;
Example 2
Set the local date and time field as a required part of the form submission:
document.getElementById("myLocalDate").required = true;
Syntax
Return the required attribute:
datetimelocalObject.required
Set the required attribute:
datetimelocalObject.required = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specifies whether the local date and time field should be a required part of the form submission.
|
Technical details
Return value: | Boolean value, if the local date and time field is a required part of the form submission, it returns true ; de lo contrario, devolver false . |
---|
Compatibilidad del navegador
Los números en la tabla indican la versión del navegador que primero admitió esta propiedad.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Compatibilidad | 10.0 | Compatibilidad | Compatibilidad | Compatibilidad |
Atención:El elemento <input type="datetime-local"> no muestra ningún campo de fecha y hora ni calendario en Firefox.