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.
as quote suggests, better find out on server side direction should used, can use if have no way of knowing it.
Comments
Post a Comment