Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
Unable to read the value of input text in arabic language in the same way I typed in Javascript

enter image description here

I am trying to read the value of an input text field entered in the Arabic language using javascript.

But as you can see in the screenshot it's not fetching the text in the same way I typed.

The number '123' which is on the right side of the input field is jumping to the left side when I try to read the entered input field value using js code.

Please help me to solve this issue.

Below is the code that I am using:

<!DOCTYPE html>
<html lang="ar">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html:lang(ar){
            direction: rtl;
        }
    </style>
</head>
<body>
    <input type="text" dir="rtl" name="" id="textbox">
</body>
</html>

Thanks in advance :)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you output the Arabic RTL text in the console, it will be shown in the LRT direction. If you output the text in another Html field with RTL set for that field it will display correctly

Here is an example. Output the Arabic text into another field will be displayed correctly.

    <!DOCTYPE html>
    <html lang="ar">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            html:lang(ar){direction: rtl;}
        </style>
    </head>
    <body>
    <input type="text" id="inputText" oninput="outputIt()">
    <div id="outputText"></div>
    </body>

    <script>
    function outputIt() {
document.getElementById("outputText").innerHTML = document.getElementById("inputText").value;
    }
    </script>
    </html>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda