How to handle right-to-left text-input fields the right way?

后端 未结 1 799
北恋
北恋 2021-01-22 06:57

I am working on a multilingual layout. What worries me is:

How to handle text-input the right way?

I\'ve build a JSFiddle to explain

相关标签:
1条回答
  • 2021-01-22 07:29

    You can try this solution from here

    Example http://jsfiddle.net/0w5rydrL/1/

    The html

    <div class="text_direction" dir="rtl">
        <input type="text" onkeyup="rtl(this);" />
    </div>
    

    The javascript function

    function rtl(element){   
        if(element.setSelectionRange){
            element.setSelectionRange(0,0);
        }
    }
    
    0 讨论(0)
提交回复
热议问题