# How to set the text direction with JavaScript?

JavascriptWeb DevelopmentFront End Scripts

To set the text direction, use the direction property with JavaScript. Set rtl for right-to-left or ltr for left-to-right text direction.

## Example

You can try to run the following code to set the text direction with JavaScript −

Live Demo

<!DOCTYPE html>
<html>
<body>
</html>