ExampleValidate an input field when the user leaves it: |
Browser Support |
1. Definition and Usage
The onblur attribute fires the moment that the element loses focus.
Onblur is most often used with form validation code (e.g. when the user leaves a form field).
Tip: The onblur attribute is the opposite of the onfocus attribute.
2. Differences Between HTML 4.01 and HTML5
None.
3. Syntax
<element onblur="script">
4. Attribute Values
Value | Description |
---|---|
script | The script to be run on onblur |