Checkbox.checked

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

document.form.
							checkbox.checked

Description

The checked property holds the current state of a check box. Because this property is a read/write Boolean, the state of the check box can be altered by changing this property.

Example

In Listing 7.37, the user is asked to select the door style wanted on his or her new car. When the order is submitted, the checked property of each check box is analyzed to determine if two different door styles were selected or none at all. If two styles were selected, the check boxes are reset by altering the checked property.

Listing 7.37 Modifying the checked Property of a Check Box
 <html> <h2>Car Purchase Sheet</h2> Step1: Please ...

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.