Get the text direction of the text inside a <bdo> element:
var x = document.getElementById("myBdo").dir;
Click the button to get the text direction of the text inside the bdo element.
<!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() {//w w w . j av a 2s .co m var x = document.getElementById("myBdo").dir; document.getElementById("demo").innerHTML = x; } </script> </body> </html>