Input DatetimeLocal autofocus attribute
Definition and usage
autofocus
Attribute setting or returning whether the local date and time field should automatically receive focus when the page is loaded.
This property reflects the HTML autofocus attribute.
See also:
HTML reference manual:HTML <input> autofocus egenskap
Example
Determine whether the local date and time field automatically receives focus when the page is loaded:
var x = document.getElementById("myLocalDate").autofocus;
Syntax
Return autofocus attribute:
datetimelocalObject.autofocus
Set autofocus attribute:
datetimelocalObject.autofocus = true|false
Attribute value
Value | Description |
---|---|
true|false |
Specify whether the local date and time field should receive focus when the page is loaded.
|
Technical details
Return value: | Boolean value, if the local date and time field automatically focuses when the page is loaded, it returns true annars returnera false . |
---|
Webbläsarstöd
Tal i tabellen anger den första webbläsarens version som helt stöder egenskapen.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Stödjer | 10.0 | Stödjer | Stödjer | Stödjer |
Observera:Elementet <input type="datetime-local"> visar inga datum- eller tidsfält/kalender i Firefox.