HTML DOM dir Property Last Updated : 16 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The DOM dir Property is used to set or return the value of a dir attribute in an Element. It defines the direction of the text in an Element Content. Syntax HTMLElementObject.dir Return Values: It returns the direction of the text. HTMLElementObject.dir = "ltr|rtl|auto" Properties: ltr: It is a default value and is used to return the text-direction towards left-to-right.rtl: It is used to return the right-to-left text-direction. Example 1: To change the direction of the text. HTML <!DOCTYPE html> <html> <head> <title> HTML DOM dir Property </title> <style> button { margin-left: 270px; } </style> </head> <body> <h1 style="color:green;font-weight:bold; text-align:center;"> GeeksForGeeks </h1> <h2 style="color:green; font-weight:bold; text-align:center"> DOM dir Property </h2> <p id="sudo" dir="ltr"> <b> GeeksForGeeks is a good website for learning computer science. </b> </p> <button onclick="geeks()">Submit</button> <p id="GFG"></p> <script> function geeks() { let g = document.getElementById("sudo").dir; document.getElementById("GFG").innerHTML = "The text-direction was changed from ltr to " + g; } </script> </body> </html> Output: Example 2: To get the direction of the text. HTML <!DOCTYPE html> <html> <head> <title> HTML DOM dir Property </title> <style> button { margin-left: 270px; } </style> </head> <body> <h1 style="color:green;font-weight:bold; text-align:center;"> GeeksForGeeks </h1> <h2 style="color:green;font-weight:bold; text-align:center"> DOM dir Property </h2> <p id="sudo" dir="ltr"> <b> GeeksForGeeks is a good website for learning computer science. </b> </p> <button onclick="geeks()">Submit</button> <p id="GFG"></p> <script> function geeks() { let g = document.getElementById("sudo").dir; document.getElementById("GFG").innerHTML = " Direction of the text is " + g; } </script> </body> </html> Output: Supported Browsers: The browser supported by DOM Dir property are listed below: Google Chrome 1Edge 12Internet Explorer 5.5Firefox 1Opera 12.1Safari 3 Comment More infoAdvertise with us Next Article HTML DOM createElement() Method M manaschhabra2 Follow Improve Article Tags : Misc Web Technologies HTML Web technologies HTML-DOM +1 More Practice Tags : Misc Similar Reads HTML DOM Style color Property The DOM style color property is used to set or return the color of the text. Syntax: It is used to set the color property.object.style.colorIt is used to return the color property.object.style.color = "color|initial|inherit" Return Values: It returns a string value that represents a text-color of an 1 min read HTML DOM cookie Property Almost every website stores cookies (small text files) on the user's computer for recognition and to keep track of his preferences. DOM cookie property sets or gets all the key/value pairs of cookies associated with the current document.Getting all the Cookies: The document.cookie method returns a s 3 min read HTML DOM isId Property The isId Property contains a boolean value that returns a true if the Element has an attribute type of ID, otherwise, it returns a false or undefined value. This Property is used for read-only. Syntax: attribute.isId Return Value: It returns a Boolean value i.e. true if the attribute type is ID, els 2 min read HTML DOM createElement() Method In an HTML document, the document.createElement() is a method used to create the HTML element. The element specified using elementName is created or an unknown HTML element is created if the specified elementName is not recognized. Syntaxlet element = document.createElement("elementName");In the abo 2 min read HTML DOM hasFocus() Method In HTML document, the document.hasfocus() the method is used for indicating whether an element or document has the focus or not. The function returns a true value if the element is focused otherwise false is returned. This method can be used to determine whether the active element is currently in fo 2 min read HTML DOM removeNamedItem() Method The removeNamedItem() method in HTML is used to remove the node with the specified name in a namednode object.Syntax: namednode.removeNamedItem( nodename )Parameter: The removeNamedItem() contains only one parameter nodename that is described below. nodename: This method accepts a single parameter n 2 min read HTML DOM domain Property The domain Property is used to return the domain name of the website server that is loaded or running in the current document. Syntax:document.domain Note: This property has been DEPRECATED and is no longer recommended.Return Value: It returns the string value representing the website's domain name 2 min read HTML DOM querySelector() Method The querySelector() method returns the first element that matches the specified Selector. It only gives one element from the HTML DOM if found else it returns null. To get all the matching elements, you can use the querySelectorAll() method.Syntax// To search in complete documemtducument.querySelect 2 min read HTML DOM querySelectorAll() Method The querySelectorAll() method in HTML is used to return a collection of an element's child elements that match a specified CSS selector(s), as a static NodeList object. The NodeList object represents a collection of nodes. The nodes can be accessed by index numbers. The index starts at 0. Note: If w 2 min read HTML DOM name Property The DOM name Property is used to return the name of the attribute. It is used for read-only. Syntax: attribute.name Return Value: This property returns a string value that represents the name of the attribute. Example: In this example, we are using DOM name Property for the attribute. HTML <!DOCT 1 min read Like