Atributo checked de HTML
El atributo checked de HTML es un atributo booleano y especifica que un elemento <input> debe estar marcado cuando se carga la página.
Puedes usar este atributo únicamente en el <input> elemento (<input type="checkbox"> y <input type="radio">).
También es posible establecer el atributo checked después de que la página se haya cargado, mediante JavaScript.
Sintaxis
html
<input type="checkbox|radio" checked>
<input type="checkbox|radio" checked="checked">Ejemplo del atributo checked de HTML:
Atributo checked de HTML
html
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<h2>HTML Form Example</h2>
<form action="/form/submit" method="post">
<input type="radio" name="game" value="football" checked /> Football
<input type="radio" name="game" value="basketball" /> Basketball
<input type="submit" value="Submit" />
</form>
</body>
</html>Practice
¿Qué hace el atributo 'checked' de HTML?