revision:
When present, it specifies that 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">.
The checked attribute can also be set after the page load, with a JavaScript.
<input type = "checkbox | radio" checked />
<input type = "checkbox | radio" checked="checked" />
The checked attribute indicates that the input element is checked, i.e. selected. Clicking the element will toggle, i.e. check or uncheck, the item.
<form style="margin-left:5vw;" ction="/action_page.php" method="get"> <input type="checkbox" name="vehicle1" value="Bike"> <label for="vehicle1"> I have a bike</label><br> <input type="checkbox" name="vehicle2" value="Car"> <label for="vehicle2"> I have a car</label><br> <input type="checkbox" name="vehicle3" value="Boat" checked> <label for="vehicle3"> I have a boat</label><br><br> <input type="submit" value="Submit"> </form>
codes:
<form style="margin-left:5vw;" action="#"> <label>Status</label><br /> <input type="radio" id="pending" name="status" value="Pending" checked> <label for="pending">Pending</label><br /> <input type="radio" id="closed" name="status" value="Closed"> <label for="closed">Closed</label><br /> <input type="submit" value="Submit">