Button.onBlur

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

onBlur="command"

Description

The onBlur event handler is defined in an <input> tag and specifies what to do when the button loses focus.

Example

The code in Listing 7.28 uses the onBlur event handler to display an alert box any time the button loses focus.

Listing 7.28 Use onBlur Event Handler to Display an Alert Box When the Button Loses Focus
<html>

<form name="myForm">
  <input type="button"
         value="Big Button"
         name="myButton"
         onBlur="alert('Blur event occurred')">
</form>

</html>
							
						

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.