You are here: Reference > JavaScript > client-side > HTML DOM > properties > dir (document, XMLDocument)

dir property (document, XMLDocument)

Browser support:
Sets or retrieves the horizontal rendering order in the current document.
The direction property takes only effect on non alphanumeric characters in Latin documents. You can also use the direction style property for similar functionality.


You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

String that sets or returns the reading order.
One of the following values:
Left to right.
Right to left.
Default: ltr.

Example HTML code 1:

This example illustrates the use of the dir property:
    <script type="text/javascript">
        function SetDir () {
            document.dir = "rtl";
    Click on the button and see the location of the exclamation mark.
    <br />
    <button onclick="SetDir ()">Modify the rendering order to right to left!</button>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content