onblur event
Examples
Implementation of a Javascript code input when the user leaves an input box:
<input type="text" onblur="myFunction()">
try it"
Definition and Usage
onblur event occurs when an object loses focus.
Onblur Javascript is often used to verify the code, generally used for form input box.
Tip: onblur event is contrary onfocus event.
grammar
In HTML:
<elementonblur="SomeJavaScriptCode">
In JavaScript:
object .onblur=function(){SomeJavaScriptCode};
参数 | 描述 |
---|---|
SomeJavaScriptCode | 必需。规定该事件发生时执行的 JavaScript。 |
Browser Support
All major browsers support onblur event
It supports HTML tags onblur event:
onblur attributes can be applied to all HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style> , and <title>.
Event objects