Css – Right to left Text HTML input

arabiccssinputright-to-left

For my website, i need to provide arabic support. Part of it is to provide input textboxes where when user types in, the new characters have to be appended to the left and the text has to be right aligned.

setting the css property to

text-align:right

didn't work, as i could not get the cursor to come to the left and add letters there. So I removed that property and added

direction:RTL

Here, the cursor came to the left and text was right aligned. but the newly added characters were not getting appended to the left. Instead they were getting appended to the right end only.

How do I fix this? please help..

For example, see the google arabic page search box. I need the exact behavior, although not with those fancy keyboard icon etc., http://www.google.com/webhp?hl=ar

Best Answer

You can use the dir="rtl" on the input. It is supported.

<input dir="rtl" id="foo"/>