Your Search Results

    Document.dir

    « DOM Reference

    Non-standard
    This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

    The Document.dir property is a DOMString representing the directionality of the text of the document, whether left to right (default) or right to left. Possible values are 'rtl', right to left, and 'ltr', left to right.

    Syntax

    dirStr = document.dir;
    document.dir = dirStr;
    

    Specifications

    HTML5 WHATWG

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    Basic support ? (Yes) [1] (Yes) ? ?
    Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
    Basic support ? (Yes) [1] (Yes) ? ?

    [1] Before Firefox 23, the Document.dir property returned "ltr" regardless of the setting of the dir attribute on the root <html> element. And if a direction was set on <html>, Document.dir had no effect in changing it visibly (though subsequent retrieval of the document.dir will assert that the directionality has been changed). However, if such an attribute is not set on <html> and the property is changed, both the document's visible directionality were changed and the document.dir property will correctly reflect the change.

    See also

    Document Tags and Contributors

    Contributors to this page: Sheppy, nairakhil13, ethertank, vali29, Brettz9, teoli
    Last updated by: teoli,
    Hide Sidebar