javascript - How to Change CSS direction property of the input field automaticly if the user can use an language rtl or ltr -


example: if use arabic language text field direction rtl , if want write new text , switch english language direction inside text field (`text-align: left) ltr automatically

you use global html5 attribute dir value of auto here, so:

<input type="text" dir="auto" /> 

from specification:

the auto keyword, maps auto state indicates contents of element explicitly embedded text, direction determined programmatically using contents of element (as described below).

note: heuristic used state crude (it looks @ first character strong directionality, in manner analogous paragraph level determination in bidirectional algorithm). authors urged use value last resort when direction of text unknown , no better server-side heuristic can applied.

http://www.w3.org/tr/html5/elements.html#the-dir-attribute

as quote suggests, better find out on server side direction should used, can use if have no way of knowing it.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -