miladd3 / automatic-direction

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

Home Page:https://miladd3.github.io/automatic-direction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

https://miladd3.github.io/automatic-direction/


Languages

Language:JavaScript 100.0%