Input DatetimeLocal autofocus attribute
Definition and usage
autofocus
Attribute settings or returns whether the local date and time field should be automatically focused when the page is loaded.
This property reflects the HTML autofocus attribute.
See also:
HTML reference manual:Propriedade autofocus do <input> do HTML
Example
Determine whether the local date and time field is automatically focused 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 |
Specifies 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 is automatically focused when the page is loaded, it returns true ; caso contrário, retorna false . |
---|
Suporte do navegador
Os números na tabela indicam a versão do navegador que suporta completamente essa propriedade.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Suporte | 10.0 | Suporte | Suporte | Suporte |
Atenção:O elemento <input type="datetime-local"> não exibe nenhum campo de data e hora nem calendário no Firefox.