Button.blur()

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+ Syntax

document.form.
							button.blur()

Description

The blur() method removes the focus from a button.

Warning

In the UNIX versions of Navigator 2 and Navigator 3, the blur() method does not work for buttons.

Example

In Listing 7.22, two buttons are created by using the <input> tag to demonstrate focus. The first button retains focus after being clicked, but the second button loses focus as soon as it is clicked due to the use of the blur() method. There are not a lot of uses for this method, but it is provided for your use all the same.

Listing 7.22 Removing Focus from a Button with the blur() Method
 <html> <h2>The Button Focus Game</h2> Click both buttons. Notice that the second ...

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.