Textarea autofocus-eigenschap

Definitie en gebruik

autofocus Deze eigenschap stelt in of retourneert of de tekstregio automatisch de focus krijgt bij het laden van de pagina.

Deze eigenschap reflects de HTML autofocus-eigenschap.

Zie ook:

HTML referentiemanual:HTML <input> autofocus-eigenschap

Voorbeeld

Vergelijk of de tekstregio automatisch in het laden van de pagina de focus krijgt:

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

Probeer het zelf

syntaxis

Geef de autofocus-eigenschap terug:

textareaObject.autofocus

Stel de autofocus-eigenschap in:

textareaObject.autofocus = true|false

eigenschapswaarde

waarde omschrijving
true|false

Specifies whether the text area should receive focus when the page is loaded

  • true - the text area receives focus
  • false - default. The text area does not receive focus

Technical details

Return value: Boolean value, returned if the text area automatically receives focus when the page is loaded true; otherwise return false.

Browser support

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