<html>
<body>
<p id="demo" style="text-align:right;">This is an example paragraph.</p>
<button type="button" onclick="myFunction()">Return text alignment of p</button>
<script>
function myFunction() {
alert(document.getElementById("demo").style.textAlign);
}
</script>
</body>
</html>