पाठ्य दिशा निर्धारित करने के लिए, दिशा का उपयोग करें जावास्क्रिप्ट के साथ संपत्ति। आरटीएल सेट करें दाएं से बाएं या ltr . के लिए बाएँ से दाएँ पाठ दिशा के लिए।
उदाहरण
जावास्क्रिप्ट के साथ टेक्स्ट की दिशा निर्धारित करने के लिए आप निम्न कोड को चलाने का प्रयास कर सकते हैं -
<!DOCTYPE html>
<html>
<body>
<h1 id="myID">Heading 1</h1>
<p>Click below to set the direction of heading to Left-to-right</p>
<button type="button" onclick="display()">Click to change the direction</button>
<script>
function display() {
document.getElementById("myID").style.direction = "rtl";
}
</script>
</body>
</html>