Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda