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 pre-selected:
<!DOCTYPE html> <html> <head> <title>HTML: <input> checked attribute - base tutorial website(oldtoolbag.com)</title> <body> <form action="action_page.php" method="get"> <input type="checkbox" name="vehicle" value="Bike">Bicicleta de montanha<br> <input type="checkbox" name="vehicle" value="Car" checked>Carro<br> <input type="submit" value="Submit"> </form> </body> </html>Teste e veja ‹/›
IEFirefoxOperaChromeSafari
Todos os navegadores mainstream suportam a propriedade checked.
A propriedade checked é um atributo booleano.
Se existir, especifica que o elemento <input> deve ser pré-selecionado (selecionado) ao carregar a página.
A propriedade checked pode ser usada com <input type="checkbox"> e <input type="radio"> juntas.
A propriedade checked também pode ser configurada após a carga da página pelo código JavaScript.
Nenhuma.
No XHTML, a abreviação de atributos é proibida, a propriedade checked deve ser definida como <input checked="checked" />。
<input checked>HTML <input> etiqueta