Text.blur()

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

							text.blur()

Description

The blur() method of the Text object removes focus from the text box. Be careful when using this method in conjunction with the Text.focus() method. 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.493 has a text box and a button. If the user highlights some of the text in the box and then clicks the Click Here to Remove Focus button, the text will no longer be highlighted.

Listing 7.493 Using the blur() Method to Remove the Focus from the Text Box
 <html> <head> <script language="JavaScript"> <!-- Hide // Define the removeFocus function called by pressing the button function ...

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.