On Facebook, for example, if you have chosen the Arabic language for your keyboard, the textbox automatically gets RTL direction.
How can I implement this on my web application? I don’t know the method or property used.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the CSS
directionproperty to achieve this:Update
To change the direction of the text dynamically based on the user input you can check the first character of input to see if it meets a given criteria, in this case a regular expression.
This is a basic example that uses
ltrdirection for ascii text andrtlfor everything else.Here’s a working example.