Bdo dir Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Bdo

Description

The dir property sets or gets the required dir attribute of a <bdo> element, which controls the text direction of the text inside a <bdo> element.

Set the dir property with the following Values

Value Description
ltr Sets a left-to-right text direction
rtl Sets a right-to-left text direction

Return Value

A String, representing the text direction of the text

The following code shows how to change the text direction of the text inside a <bdo> element to "right-to-left":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p><bdo id="myBdo" dir="rtl">This paragraph will go right-to-left.</bdo></p>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  w  ww .  ja v  a2s.  c  o  m
    document.getElementById("myBdo").dir = 'rtl';

}
</script>

</body>
</html>

Related Tutorials