Checkbox.defaultChecked

JavaScript 1.0+, JScript 3.0+ Nav2+, IE 4+ Syntax

document.form.
							checkbox.defaultChecked

Description

The defaultChecked property holds the initial state of a check box as defined by the checked attribute of the <input> tag. Because this property only holds the initial state of the check box, it is a read-only Boolean value.

Example

In Listing 7.39, the defaultChecked property is used to reset the car door check boxes to their initial state.

Listing 7.39 Resetting Check Boxes with the defaultChecked Property
 <html> <h2>Car Purchase Sheet</h2> Step1: Please select the door style you want on your new car:<BR> <form name="orderForm"> <input type="checkbox" name="door4">4 doors<br> <input type="checkbox" name="door2" ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.