Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!