Checkbox.focus()

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

document.form.
							checkbox.focus()

Description

The focus() method applies focus to a check box without invoking the checkbox's onFocus event handler.

Warning

In the UNIX versions of Navigator 2 and Navigator 3, the focus() method does not work for check boxes.

Example

In Listing 7.40, two check boxes are created by using the <input> tag. Click the first check box and then the second check box. Finally, click the Move Focus button to move the focus back to the first check box. Do not be surprised if you do not see a difference in the check boxes in this example. In most browsers, you will not be able to detect the difference between a check box that is focused versus one ...

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.