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

157
Visualizações
How to Insert dot(.) again in textarea, if we have created a function to replace it?

I have created a function to replace dot(.) into purnviraam, it works fine. but If we need to insert " . " again in textarea, I have created a button neart textarea with function. it inserts dot"." but pressing shift, it also converts in purnviraam. Please guide me, I don't have much knowledge of js coding.

$(function() {
  $('textarea').on("keyup", function(e) {
    var val = $(this).val();
    var str = val.replace('.', String.fromCharCode(2404));
    $(this).val(str);
  });
});


function myFunction1() {
  insertfullstop.data.value += '.';
  document.getElementById("data").focus();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
  <tr>
    <td colspan="1">
      <form id="insertfullstop">
        <textarea type='text' id="data" class="js-copytextarea" style="width: 100%; max-width: 400px; height: 200px; border-radius: 6px 6px 6px 6px;" name="data" autofocus="" placeholder="Start Type Here................"></textarea>
      </form>
    </td>
  </tr>
  <tr align="right">
    <td style="padding-top: 5px; float='center' padding-left: 1px; " colspan="1">
      <strong style="font-size: 16px;"></strong>
      <button id="fullstop" OnClick="myFunction1()" class="btn1" title="Full Stop" type="button">.</button>
    </td>
  </tr>
</table>

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

0

The problem is that you replace . with | on EVERY keyup event, which means that; you can add the dot with your function correctly but when you type the textarea it is going to replace the previously added dot with |

To solve this: check if the typed character is a dot or not. If it is a dot, only then, replace it with a |. This way, it will not replace the previously added dot.

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