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

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

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 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