我正在研究多语言布局。我担心的是:
How to handle text-input the right way?
我已经构建了一个 JSFiddle解释我的问题。
- 如果我只添加
dir="rtl"
,单词会从右到左显示,而不是每个字符 - 如果我添加从右到左的 CSS 样式,包含的数字也会翻转
How can i combine numbers and text, so a hebrew input is showing correctly?
最佳答案
您可以从 here 尝试此解决方案
示例 http://jsfiddle.net/0w5rydrL/1/
html
<div class="text_direction" dir="rtl">
<input type="text" onkeyup="rtl(this);" />
</div>
JavaScript 函数
function rtl(element){
if(element.setSelectionRange){
element.setSelectionRange(0,0);
}
}
关于html - 如何正确处理从右到左的文本输入字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26361649/