English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML: <select> autofocus Eigenschaft

Die autofocus-Eigenschaft des <select>-Elements ist eine boolesche Eigenschaft. Wenn sie vorhanden ist, wird angegeben, dass die Dropdown-Liste beim Laden der Seite automatisch in den Fokus gelangen soll.

 HTML <select> Tag

Online-Beispiel

Dropdown-Liste mit automatischer Ausrichtung:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>HTML:<select> autofocus Eigenschaft-基础教程(oldtoolbag.com)</title> 
</head>
<body>
<select autofocus>
<option value="php">PHP</option>
<option value="java">Java</option>
<option value="rust">Rust</option>
<option value="pythone">Python</option>
</select>
</body>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 10, Opera, Chrome, and Safari support the autofocus attribute.

Note:Firefox or Internet Explorer 9 and earlier versions do not support the autofocus attribute of the <select> tag.

Definition and Usage

The autofocus attribute is a boolean attribute.

The autofocus attribute specifies that the dropdown list automatically receives focus when the page is loaded.

HTML 4.01 versus HTML5differences

The autofocus attribute is in HTML5 New attributes of the <select> tag.

Differences between HTML and XHTML

In XHTML, attribute shorthand is prohibited, and the autofocus attribute must be defined as <select autofocus="autofocus">.

Syntax

<select autofocus>
 HTML <select> Tag