Textarea.blur()

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

							textarea.blur()

Description

The blur() method of the Textarea object removes the focus from the text area. Be careful when using this method in conjunction with the Textarea.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.507 has a text area 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.507 Using the blur() Method to Remove the Focus from the Text Area
 <html> <head> <script language="JavaScript"> <!-- Hide // Define the removeFocus function called by pressing ...

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.