Files
freeCodeCamp/mock-guide/english/html/attributes/input-checked-attribute/index.md
Stuart Taylor 7da04a348b fix: Update packages and fix local dev (#26907)
<!-- Please follow this checklist and put an x in each of the boxes, like this: [x]. It will ensure that our team takes your pull request seriously. -->

- [x] I have read [freeCodeCamp's contribution guidelines](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md).
- [x] My pull request has a descriptive title (not a vague title like `Update index.md`)
- [x] My pull request targets the `master` branch of freeCodeCamp.
2018-10-23 18:48:46 +05:30

816 B

title
title
Input Checked Attribute

Input Checked Attribute

The checked attribute is a boolean attribute.

When present, it specifies that an element should be pre-selected (checked) when the page loads.

The checked attribute can be used with and .

The checked attribute can also be set after the page load, through JavaScript.

Take a look at the following example:

<form action="/action_page.php">
  <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="Submit">
</form>

In the example above when the web page is loaded by default the first checkbox will come automatically selected due to the checked attribute.