Giter Site home page Giter Site logo

miladd3 / automatic-direction Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 3.0 51 KB

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

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

JavaScript 100.00%
javascript-library javascript-tools direction ltr rtl character-count pure-javascript

automatic-direction's Introduction

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

automatic-direction's People

Contributors

miladd3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

automatic-direction's Issues

Numbers and punctuation

Sorry for my newbie question, but is there a way that the numeric and punctuation characters be considered as Latin? Because I'm trying to use your script in a form, and when I write a mailing address in Latin, your code considers the numbers to be Arabic and puts the number at the end of the line.
Thanks for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.