English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <input> checked Attribute

This article introduces the HTML input checked attribute, which is a boolean attribute specifying that the <input> element should be pre-selected (checked) when the page is loaded.

 HTML <input> tag

Online Example

HTML Form with Default Checked Checkbox:

<!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">Mountain Bike
  <input type="checkbox" name="vehicle" value="Car" checked>Car
  <input type="submit" value="Submit">
</form>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the checked attribute.

Definition and Usage

The checked attribute is a boolean attribute.

If present, it specifies that the <input> element should be pre-selected (checked) when the page loads.

The checked attribute can be used with <input type="checkbox"> and <input type="radio"> together.

The checked attribute can also be set through JavaScript code after the page has finished loading.

HTML 4.01 With HTML5Differences

None.

Differences between HTML and XHTML

In XHTML, attribute shorthand is prohibited, and the checked attribute must be defined as <input checked="checked" />。

Syntax

<input checked>
 HTML <input> tag