ofskyMohsen
ofskyMohsen

Reputation: 1211

How to make direction of input text in jquery mobile right to left?

In jQuery mobile I used a input text :

<input type="text" data-clear-btn="true" id="txt_name_contractor">

and in my css file I set this properties :

direction : rtl
text-align : right

But when I type in this input text , It is left to right . How I should fix this problem?

Upvotes: 1

Views: 394

Answers (1)

erol_smsr
erol_smsr

Reputation: 1496

function rtl(element) {   
    if(element.setSelectionRange) {
        element.setSelectionRange(0,0);
    }
}

$('.myInput').keyup(function(e) {
    rtl(this);
});

Answer from here, by @Anshul

Fiddle

Upvotes: 3

Related Questions