English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Die selected-Eigenschaft ist eine boolesche Eigenschaft. Wenn sie vorhanden ist, wird sie angeben, dass eine Option bei der Ladezeit der Seite vorgewählt werden soll. Die vorgewählte Option wird zuerst in der Abwahlliste angezeigt.
Abwahlliste mit voreingestellter Option:
!DOCTYPE html <html> <head> <title>HTML:<option selected 属性 - 基础教程网(oldtoolbag.com)</title> </head> <body> <select> <option value="PHP">PHP</option> <option value="HTML">HTML</option> <option value="C++">C++</option> <option value="GOLANG" selected>GOLANG</option> <option value="JAVA">JAVA</option> </select> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the selected attribute.
The selected attribute is a boolean attribute.
If present, it specifies that an option should be pre-selected when the page loads.
Pre-selected options will be displayed first in the drop-down list.
Hint: You can also set the selected attribute using JavaScript after the page has loaded.
None.
In XHTML, attribute shorthand is prohibited, the selected attribute must be defined as <option selected="selected">.
<option selected>HTML <option> Tag