HTML DOM blur() Method Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The DOM blur method is used to remove the keyboard focus from the current element and also give focus with the help of the focus() method. We can apply the blur to any element and enable it by doing some operations. For example, we can blur to text-box by clicking a button. Syntax: Object.blur() Example: In this example, we will use the HTML DOM blur() method. html <html> <head> <title>HTML DOM blur() Method</title> </head> <body style="text-align: center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2> DOM blur Property </h2> <input type="text" id="txt" placeholder="Enter text here"> <br> <br> <button type="button" onclick="inputFocus()">Focus</button> <button type="button" onclick="inputBlur()">Blur</button> <script> function inputFocus() { document.getElementById('txt').focus(); } function inputBlur() { document.getElementById('txt').blur(); } </script> </body> </html> Output: Supported Browsers: The browser supported by the blur() method are listed below: Google Chrome 1Edge 12Internet Explorer 5.5Firefox 1.5Opera 8Safari 3 Comment More infoAdvertise with us Next Article HTML DOM inputEncoding Property V Vishal Chaudhary 2 Follow Improve Article Tags : Web Technologies HTML Web technologies HTML-DOM Similar Reads HTML DOM Canvas Object The DOM Canvas Object is used to represent the HTML <Canvas> element. The <canvas> tag is used to draw graphics in the document using javascript. It is new in HTML5. The canvas element is accessed by getElementById(). Syntax: accessed by getElementById("id"). Where âidâ is the ID assigne 2 min read HTML DOM importNode() Method The HTML | DOM importNode() Method creates a copy of a node from another document and imports it to the current document. Syntax: document.importNode(externalNode, [deep]) Parameters: externalNode: Node which we need to import from another document, it can be of any type.[deep]: We can set its val 2 min read HTML DOM inputEncoding Property The inputEncoding property returns the character encoding used for parsing the document. This property doesn't have any default value. Syntax:document.inputEncodingParameters:The HTML DOM inputEncoding property does not require any parameter.Return Value:The HTML DOM inputEncoding property returns a 2 min read HTML DOM normalizeDocument() Method The normalizeDocument() method in HTML is used to normalize an HTML document by remove any empty text nodes if exists. After removing the empty nodes, it also merges all of the adjacent nodes present in the document. For Example, consider the below element: Element Geeks Text node: "" Text node: "He 2 min read HTML DOM lang Property In HTML document, the lang property is used to set or return the value of the lang attribute of an element. This attribute specifies the language code of the element's content. The element attribute takes "en" for English, "ja" for Japanese, "es" for Spanish, and so on. The default value of this att 2 min read HTML DOM KeyboardEvent key Property The keyboardEvent key property in HTML is used to return the value of the key pressed when a key event occurs. It returns a single-character or multi-character string depending on which key is pressed. It is a read-only property. Syntax: event.key Return Value: It returns a string that represents th 1 min read HTML DOM keyboardEvent charCode Property The keyboardEvent charCode property in HTML is used to return the unicode value of a character key pressed during a keypress event. It is a read-only property. The unicode character denotes the number of a character(e.g. the unicode for "A" is 65). Syntax: event.charCode Note: This property has been 1 min read HTML DOM hasChildNodes() Method The HTML hasChildNodes() property will return true if the given node has a child node or false if it doesn't have any child nodes. A blank line or whitespace is also treated as a child node so it also returns true on a blank line or whitespace. Prerequisite DOM (Document Object Model) Parameters: No 2 min read HTML DOM nodeValue Property The HTML DOM nodeValue Property is used to describe the property of a given node. It is used to set or get the nodeValue in Any Html document. Prerequisites DOM (Document Object Model) Syntax: let x = document.getElementById("nodeId").firstChild; x.nodeType; x.nodeName; x.nodeValue; Parameters: No p 1 min read HTML DOM KeyboardEvent code Property The keyboardEvent code property in HTML represents a physical key on the keyboard. It is used to return the key that triggers the event. Syntax: event.code Return Value: It returns a string that represents which key is pressed. Example 1: With KeyDown Event HTML <html> <head> <title 2 min read Like