Bdo dir Attribute

Definition and Usage

dir Sets or returns the value of the dir attribute of the <bdo> element.

<bdo> dir attribute Specifies the text direction inside the <bdo> element.

Note:For the <bdo> element, the dir attribute is required.

See also:

HTML Reference Manual:HTML <bdo> Tag

Example

Example 1

Change the text direction inside the <bdo> element to "right to left":

document.getElementById("myBdo").dir = "rtl";

Try it yourself

Example 2

Get the text direction of the text inside the <bdo> element:

var x = document.getElementById("myBdo").dir;

Try it yourself

Syntax

Return the dir attribute:

bdoObject.dir

Set the dir attribute:

bdoObject.dir = "ltr|rtl"

Attribute Value

Value Description
ltr Specifies the text direction from left to right.
rtl Specifies the text direction from right to left.

Technical Details

Return Value: A string value that represents the text direction of the text.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <bdo> dir Attribute