Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML onblur Event Attribute

HTML onblur Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Validate when the user leaves the input field:

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onblur event attribute


Definition and Usage

onblur is triggered when an element loses focus.

Onblur is often used for code validation (when the user leaves a form input field).

Tip: The opposite attribute of the onblur attributeonfocus attribute.


Differences between HTML 4.01 and HTML5

none.


Syntax

<

element

onblur="

script

">

HTML Event Attributes HTML Event Attributes