Javascript DOM HTML Bdo dir Property set

Introduction

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

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

Click the button to change the text direction of the text inside the <bdo> element.

View in separate window

<!DOCTYPE html>
<html>
<body>

<p><bdo id="myBdo" dir="ltr">This paragraph goes left-to-right.</bdo></p>  
<button onclick="myFunction()">Test</button>

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

</body>
</html>

The dir property sets or gets the dir attribute of a <bdo> element.

It sets the text direction of the text inside a <bdo> element.

Property Values

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



PreviousNext

Related