Latest web development tutorials

HTML onblur event properties

HTML Event Attributes HTML Event Attributes

Examples

Verified when the user leaves an input field:

<input type="text" name="fname" id="fname" onblur="upperCase()">

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support onblur event attributes


Definition and Usage

onblur Fires when the element loses focus.

Onblur typically used for code validation (when the user leaves the form input fields when).

Tip: Instead attribute onblur attribute onfocus attribute.


Differences between HTML 4.01 and HTML5

no.


grammar

<elementonblur=" script ">

Property Value

描述
script 规定该onblur事件触发时执行的脚本


HTML Event Attributes HTML Event Attributes