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

153
Views
Javascript to fill definite values only

I am trying to use a JS code to fill up elements with their already filled up values as desribed in the table here

The JS code suggested by some members here which has worked partially is this:

document.querySelectorAll("[id^='1253']")
  .forEach(o => {
    if (o.value) o.value = `(${o.value})`;
  });

Problem is that I need this condition that, if value =>0.9 then also it should NOT do the prepend and append function and leave the value as it is like shown in the table picture above. The code above is filling for all non-blank values (including values=>0.9). Please help me to solve my problem. Regards, Vicky.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

document.querySelectorAll("[id^='1253']")
  .forEach(o => {
    if (o.value && parseFloat(o.value) < 0.9)
      o.value = `(${o.value})`;
  });

just do add another condition parseFloat(o.value) < 0.9 means only the value with below 0.9 will be changed. parseFloat parses the o.value to float so it can be compared to 0.9

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!