Checkbox.click()

JavaScript 1.1+, JScript 3.0+ Nav3+, IE 4+ Syntax

document.form.
							checkbox.click()

Description

The click() method simulates the click event. The clicked property is adjusted acc ordingly when this method is used.

Example

In Listing 7.38, the user is asked to select the door style wanted on his or her new car. If the user selects the 4-door option, the user is alerted that the 4-door has lots of leg room. If the 2-door option is selected, a message is posted to encourage the user to consider the 4-door model. In addition to this message, the message about extra leg room is displayed, thanks to the click() method.

Listing 7.38 Using the Check Box's click() Method
 <html> <h2>Car Purchase Sheet</h2> Step1: Please select ...

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.