0

I'm working on entering dollar amounts into a text input field. Is there a way when I have direction set to RTL that I can maintain the cursor to be at the farthest right position and keep it there?

<input type="text" id="textArea">

CSS:

#textArea {
direction:RTL;}

This just starts the cursor on the right, but when you type it still moves in the standard fashion. Any help would be appreciated.

Jared
  • 3,651
  • 11
  • 39
  • 64

3 Answers3

3

Since you are dealing with text inside of an input, just use text-align: right;

#textArea{
    text-align: right;
}
Jmh2013
  • 2,625
  • 2
  • 26
  • 42
0

Another solution is to use the dir attribute

<input type="text" dir="rtl" id="textArea">
Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36
0

Add another attribute to your input that looks something like this:

onkeyup="rtl(this);"
Amorfus
  • 11
  • 4