JavaScript element.blur() Method
You are Here:
JavaScript element.blur() Method
The element.blur()
method shifts the focus away from the specified element.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p>Name</p>
<input type="text" value="John" autofocus>
<p>Age</p>
<input type="text" value="45">
<p>Click on the button to blur and to focus.</p>
<button onclick="myBlur()">Blur</button>
<button onclick="myFocus()">Focus</button>
<p id="point"></p>
<script>
var x = document.getElementById("point");
var elem = document.getElementsByTagName("input")[0];
function myBlur(){
elem.blur();
}
function myFocus(){
elem.focus();
}
</script>
</body>
</html>
Syntax
element.blur()
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.