<!DOCTYPE html>
<html lang="en-US">
<body>
<p dir="ltr">Click on the button to find the directionality of this paragraph.</p>
<button onclick="myFunction()">Click Me</button>
<p id="point"></p>
<script>
var x = document.getElementById("point");
var elem = document.getElementsByTagName("p")[0];
function myFunction(){
x.innerHTML = elem.dir;
}
</script> </body>
</html>