Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Javascript automatic text direction RTL and LTR ,based on character count

Notifications You must be signed in to change notification settings

miladd3/automatic-direction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

automatic-direction

A lightweight Javascript Library for automatic direction change of input between rtl and ltr based on character count.

HTML5 dir="auto" attribution is good, but it just depends on first character in most browsers ,that is not functional on most arabic and persian web applications.

Demo link

How to use

Include automatic-direction.js in bottom of the page before body close tag

<script src="js/automatic-direction.js"></script>

add .dir-auto class to input that you want to automate direction on it

<textarea class="dir-auto" ></textarea>

Licence and Credits

The code and the documentation are released under the MIT License

By Milad Dehghan

Thanks to @sallar for converting it to Vanilla js