HTML <select> autofocus Attribut

Definition und Verwendung

autofocus Das Attribut ist ein boolesches Attribut.

Wenn vorhanden, legt es fest, dass die Dropdown-Liste beim Laden der Seite automatisch den Fokus erhält.

Beispiel

Automatisch fokusierende Dropdown-Liste:

<label for="cars">Wählen Sie eine Automarke aus:</label>
<select name="cars" id="cars" autofocus>
  <option value="audi">Audi</option>
  <option value="byd">BYD</option>
  <option value="geely">Geely</option>
  <option value="volvo">Volvo</option>
</select>

Probieren Sie es selbst aus

Syntax

<select autofocus>

Browser-Unterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützt 10.0 Nicht unterstützt Unterstützt Unterstützt