input checked Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The checked attribute is a boolean attribute to set if an <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">.

In XHTML, the checked attribute must be defined as <input checked="checked" />.

An HTML form with a pre-selected checkbox:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php" method="get">
  <input type="checkbox" name="vehicle" value="css"> css <br>
  <input type="checkbox" name="vehicle" value="html" checked> html<br>
  <input type="submit" value="Submit">
</form><!--from  ww w.  j a  v a2  s . c  o  m-->

</body>
</html>

Related Tutorials