Input Text autofocus Eigenschap

Definitie en gebruik

autofocus Eigenschap instellen of teruggeven of het tekstveld automatisch focus moet krijgen bij laden van de pagina.

Deze eigenschap reflecteert de HTML autofocus eigenschap.

Zie ook:

HTML Referentie Handboek:HTML <input> autofocus attribute

Voorbeeld

Vind uit of het tekstveld automatisch focus krijgt bij laden van de pagina:

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

Probeer het zelf

Syntax

Geef de autofocus-eigenschap terug:

textObject.autofocus

Stel de autofocus-eigenschap in:

textObject.autofocus = true|false

Eigenschapswaarde

Waarde Beschrijving
true|false

Regel of de tekstveld moet focus krijgen bij laden van de pagina.

  • true - the text field gains focus
  • false - default. The text field does not gain focus

Technical details

Return value: Boolean value, returned if the text field automatically gains focus when the page is loaded 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