Il tag HTML <option>


Descrizione

Il tag HTML <option> permette di definire delle opzioni per una select.

Esempio

<!DOCTYPE html>
<html>
<head>
<title>HTML option Tag</title>
</head>
<body>
<form action="/cgi-bin/dropdown.cgi" method="post">
<select name="dropdown">
<option value="Java" selected>Maths</option>
<option value="Ruby">Physics</option>
</select>
<input type="submit" value="Submit" />
</form>
</body>
</html>

Produrrà il seguente risultato:

Attributi Globali

Questo tag supporta tutti gli attributi globali descritti in - HTML - Referenze Attributi

Attributi Specifici

The HTML <option> supporta anche i seguenti attributi aggiuntivi:

AttributoValoreDescrizione
disabled disabledDisabilita il campo.
label textDefinisce un etichetta da utilizzare quando si usa il tag <optgroup>.
selected selectedDefinsce l'opzione selezionata di default.
valuetextDefinsce il valore dell'opzione selezionata da inviare al server.

Attributi Evento

Questo tag supporta tutti gli attributi evento descritti in - HTML - Referenze Eventi

Compatibilità Browser

ChromeFirefoxIEOperaSafariAndroid
SiSiSiSiSiSi
html_tags_reference.htm
Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements