files/en-us/web/api/htmlelement/dir/index.md
{{ApiRef("HTML DOM")}}
The HTMLElement.dir property indicates the text writing directionality of the content of the current element. It reflects the element's dir attribute.
Note that if the dir attribute is unspecified, the element itself may still inherit directionality from its parent. However, that inherited directionality is not reflected by this property's value.
The text writing directionality of an element is which direction that text goes (for support of different language systems). Arabic languages and Hebrew are typical languages using the RTL directionality.
One of the following:
"ltr"
"rtl"
"auto"
""
const para = document.getElementById("para1");
para.dir = "rtl";
// change the text direction on a paragraph identified as "para1"
{{Specifications}}
{{Compat}}
dir
global attribute