English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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 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 ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the checked attribute.
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.
None.
In XHTML, attribute shorthand is prohibited, and the checked attribute must be defined as <input checked="checked" />。
<input checked>HTML <input> tag