window.blur()

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

							window.blur()

Description

The blur() method of the Window object removes the focus from the window. Be careful when using this method in conjunction with the focus() method of objects. It can lead to a focus/blur loop, where the browser blurs a focus as soon as it is done, and vice versa.

Example

Listing 7.527 has two buttons. When the user clicks the Open button, a second, smaller window is opened. If the Blur button is clicked, the focus is removed from the parent window and placed on the child window.

Listing 7.527 Using the blur() Method to Remove the Focus from a Window
 <html> <head> <title>Using the blur() Method</title> <script language="JavaScript"> <!-- ...

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.