English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The autofocus attribute of the <select> element is a boolean attribute. If present, it specifies that the dropdown list should automatically receive focus when the page is loaded.
Dropdown list with autofocus:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML:<select> autofocus attribute usage-基础教程(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 it out ‹/›
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.
The autofocus attribute is a boolean attribute.
The autofocus attribute specifies that the dropdown list automatically receives focus when the page is loaded.
The autofocus attribute is an HTML5 New attributes of the <select> tag.
In XHTML, attribute shorthand is prohibited, and the autofocus attribute must be defined as <select autofocus="autofocus">.
<select autofocus>HTML <select> tag