HTML input checked property
Examples
With a preselected box HTML form:
<form action="demo_form.php" method="get">
<input type="checkbox" name="vehicle" value="Bike"> I have a bike<br>
<input type="checkbox" name="vehicle" value="Car" checked> I have a car<br>
<input type="submit" value="提交">
<input type="checkbox" name="vehicle" value="Bike"> I have a bike<br>
<input type="checkbox" name="vehicle" value="Car" checked> I have a car<br>
<input type="submit" value="提交">
try it"
Browser Support
All major browsers support the checked property.
Definition and Usage
checked property is a Boolean property.
Attribute specifies checked when the page loads should be pre-selected <input> elements.
checked attributes apply to <input type = "checkbox"> and <input type = "radio">.
Properties can also be checked after the page is loaded, set by JavaScript code.
Differences between HTML 4.01 and HTML5
no.
Differences between HTML and XHTML
In XHTML, prohibit attribute minimization, checked attribute must be defined as <input checked = "checked" />.
grammar
<input checked>
HTML <input> tag