Атрибут checked HTML
Атрибут checked HTML является булевым атрибутом и указывает, что элемент <input> должен быть отмечен при загрузке страницы.
Этот атрибут можно использовать только для элемента <input> (<input type="checkbox"> и <input type="radio">).
Также можно установить атрибут checked после загрузки страницы с помощью JavaScript.
Синтаксис
html
<input type="checkbox|radio" checked>
<input type="checkbox|radio" checked="checked">Пример использования атрибута checked в HTML:
Атрибут checked в 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>Практика
Что делает атрибут HTML 'checked'?