Javascript Reference
Categories: onblur

javascript onblur Description

@March 15, 2008, 1:22 a.m.
onblurFirefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM 2  

Bubbles: No; Cancelable: No  

Fires after the current element loses focus (due to some other element receiving focus) or invoking the blur( ) method of the current element. The onblur event fires before the onfocus event in the other element.

 

Avoid using the onblur event in text input fields to trigger form validation, especially if the validation routine displays an alert dialog box upon discovering an error. Interaction among the onblur and onfocus events, along with the display and hiding of an alert dialog box can put you into an infinite loop. Use onchange instead.

 

Although the onblur event has been supported for form controls and window objects since the early days of scriptable browsers, modern browsers can fire the event on virtually any other rendered element, provided the tabindex attribute is set for the element. Note that IE for Windows is known to omit firing the onblur event on window objects.

 
Typical Targets

For all browsers, input (of type text and password), textarea, select, and window objects; for IE 5 or later and Netscape 6, add any rendered element for which the tabindex attribute is assigned a value.


Powered by Linode.