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

137
Visualizações
How to change this javascript code to jQuery specially the string concatination part

I want to convert this javascript into jQuery but am unable to do so

//JavaScript

var d_Inp = document.getElementById("dollar-input");
var dsign = document.getElementById("dollar-sign");
d_Inp.addEventListener("keyup", () => {
  let len = d_Inp.value.length;

  dsign.style.right = `${len + 3}ch`;
});

//jQuery

$(document).ready(function(){
    $("#dollar-input").keyup(function(){
        let len = $("#dollar-input").val.length;
        $("label").css("right","len+3+ch");
    })
 })

I think I am wrong somewhere $("label").css("right","len + 3ch"); here

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

0

In jQuery you need to use val() to get the value of input

 let len = $("#dollar-input").val().length

Then while adding css you directly added string instead of using value from the len

$("label").css("right",len+3+"ch");
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