🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

automatic-direction is a jQuery plugin which automatically set the text direction of your text field to Right To Left based on Character Count.

Character-Counter Arabic persian

Documentation

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>

JQuery

This Library is Plain Javascript with no need of JQuery. but if you need jquery version of this library for any reason there is a jquery.automatic-direction.js with the same functionality with jquery selectors and functions.

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


You May Also Like