Input Password autofocus-eigenschap

Definitie en gebruik

autofocus Instellen of retourneren van het passworld-veld dat automatisch focus moet krijgen bij het laden van de pagina.

Deze eigenschap reflecteert de HTML autofocus-eigenschap.

Zie ook:

HTML Referentiemanual:HTML <input> autofocus attribute

Voorbeeld

Vergelijk of het wachtwoordveld automatisch focus krijgt bij het laden van de pagina:

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

Probeer het zelf

Syntax

Geef de autofocus-eigenschap terug:

passwordObject.autofocus

Stel de autofocus-eigenschap in:

passwordObject.autofocus = true|false

eigenschapswaarde

waarde beschrijving
true|false

Specifies whether the password field should gain focus when the page is loaded.

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

Technical details

Return value: Boolean value, returned if the password field automatically gains 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