JavaScript Reference/Javascript Methods/blur
"blur()" Example
<html>
<body>
<script language="JavaScript">
function function1(){
document.getElementById("myButton").blur();
document.getElementById("myButton").innerText = "This button lost its focus";
alert("The button lost its focus");
}
</script>
<input id="myButton"
type="button"
onclick="function1();"
value="Tab to put in focus."
onFocus="this.innerText="In focus. Click me to lose focus"">
</body>
</html>
"blur()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <acronym> |
| |<address> <applet> |
| |<area> <b> |
| |<bdo> <big> |
| |<blockquote> <body> |
| |<button> <caption> |
| |<center> <cite> |
| |<custom> <dd> |
| |<del> <dfn> |
| |<dir> <div> |
| |<dl> <dt> |
| |<em> <embed> |
| |<fieldset> <font> |
| |<form> <frame> |
| |<frameset> <hn> |
| |<hr> <i> |
| |<iframe> <img> |
| |<input type="button"> <input type="checkbox"> |
| |<input type="file"> <input type="image"> |
| |<input type="password"> <input type="radio"> |
| |<input type="reset"> <input type="submit"> |
| |<input type="text"> <ins> |
| |<isindex> <kbd> |
| |<label> <legend> |
| |<li> <listing> |
| |<marquee> <menu> |
| |<object> <ol> |
| |<p> <plaintext> |
| |<pre> <q> |
| |<rt> <ruby> |
| |<s> <samp> |
| |<select> <small> |
| |<span> <strike> |
| |<strong> <sub> |
| |<sup> <table> |
| |<tbody> <td> |
| |<textarea> <tfoot> |
| |<th> <thead> |
| |<tr> <tt> |
| |<u> <ul> |
| |<var> window |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"blur()" Syntax, Parameters and Note
Note:
Element loses focus.
The onBlur event is triggered as a result of calling this method.
Syntax:
window.blur()
document.getElementById("elementID").blur()
document.all.elementID.blur() // IE only