English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article introduces the HTML input checked attribute, which is a boolean attribute that specifies that the <input> element should be pre-selected (checked) when the page is loaded.
HTML form with a checkbox selected by default:
<!DOCTYPE html> <html> <head> <title>HTML: <input> checked attribute - Basic Tutorial Website (oldtoolbag.com)</title> <body> <form action="action_page.php" method="get"> <input type="checkbox" name="vehicle" value="Bike">Mountain bike<br> <input type="checkbox" name="vehicle" value="Car" checked>Automobile<br> <input type="submit" value="Submit"> </form> </body> </html>Prova a vedere ‹/›
IEFirefoxOperaChromeSafari
Tutti i browser mainstream supportano l'attributo checked.
L'attributo checked è un attributo booleano.
Se presente, specifica che l'elemento <input> deve essere selezionato (selezionato) al caricamento della pagina.
L'attributo checked può essere usato con <input type="checkbox"> e <input usato insieme a type="radio">.
L'attributo checked può anche essere impostato tramite codice JavaScript una volta che la pagina è stata caricata.
Nessuna.
In XHTML, è proibita la abbreviazione degli attributi, l'attributo checked deve essere definito come <input checked="checked" />.
<input checked>HTML <input> etichetta