Input Time autofocus-eigenschap

Definitie en gebruik

autofocus Eigenschap instellen of retourneren of het tijdveld automatisch focus moet krijgen bij het laden van de pagina.

Deze eigenschap reflecteert de HTML autofocus-eigenschap.

Zie ook:

HTML referentiemanualHTML <input> autofocus attribute

Voorbeeld

Controleer of het tijdveld automatisch focus krijgt bij het laden van de pagina:

var x = document.getElementById("myTime").autofocus;

Probeer het zelf

Syntaxis

Geef de autofocus-eigenschap terug:

timeObject.autofocus

Stel de autofocus-eigenschap in:

timeObject.autofocus = true|false

Waarde van het attribuut

Waarde Beschrijving
true|false

Bepaalt of het tijdveld focus moet krijgen bij het laden van de pagina.

  • true - het tijdveld heeft focus gekregen
  • false - standaard. Het tijdveld heeft geen focus gekregen

Technische details

Return value: Boolean value, if the time field automatically focuses when the page is loaded, it returns true, otherwise return false.

Browser support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="time"> element does not display as any time field in Firefox.