Easy Tutorial
❮ Prop Style Wordspacing Prop Html Tabindex ❯

onblur Event

Event Object

Example

Execute a JavaScript code snippet when the user leaves an input field:


Definition and Usage

The onblur event occurs when an object loses focus.

Onblur is commonly used for JavaScript validation code, typically for form input fields.

Note: The opposite event to onblur is the onfocus event.

Syntax

In HTML:

In JavaScript:

Parameter Description
SomeJavaScriptCode Required. The JavaScript to be executed when the event occurs.

Browser Support

All major browsers support the onblur event.


HTML Tags Supporting the onblur Event:

The onblur attribute can be used with all HTML elements, except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>.

❮ Prop Style Wordspacing Prop Html Tabindex ❯