Get Bdo Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Bdo

Introduction

The Bdo object represents an HTML <bdo> element.

You can access a <bdo> element by using getElementById():

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()">get the text direction inside the bdo element</button>

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

<script>
function myFunction() {//from  w  w  w  .  jav  a  2  s  .  c  o m
    var x = document.getElementById("myBdo");
    if (x.dir === "rtl") {
        document.getElementById("demo").innerHTML = "Text direction is right to left.";
    } else {
        document.getElementById("demo").innerHTML = "Text direction is left to right.";
    }
}
</script>

</body>
</html>

Related Tutorials