Home >Web Front-end >JS Tutorial >What is the usage of blur in JavaScript?
The usage of blur in JavaScript is "anchorObject.blur()". Blur means losing a certain focus. It is mostly used in input boxes. If the focus is lost, the cursor will no longer be there, and content cannot be input. .
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
means losing a certain focus. It is mostly used in input boxes. If the focus is lost, the cursor will no longer be there and the content cannot be entered.
The relative focus is focus
Grammar
anchorObject.blur()
Examples
<html> <head> <style type="text/css"> a:active {color:green} </style> <script type="text/javascript"> function getfocus() {document.getElementById('myAnchor').focus()} function losefocus() {document.getElementById('myAnchor').blur()} </script> </head> <body> <a id="myAnchor" href="http://www.w3school.com.cn">Visit W3School.com.cn</a> <br /><br/> <input type="button" onclick="getfocus()" value="Get focus"> <input type="button" onclick="losefocus()" value="Lose focus"> </body> </html>
[Recommended learning: javascript advanced tutorial】
The above is the detailed content of What is the usage of blur in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!