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

288
Vistas
How do i Fix this NaN

whenever i call for the inputs made inside the table they end being NaN and it then cause all of my code to crash please check out the image attached to this post to get a full picture of what i am talking about, I even went forward to do more and when I call for the input made for user for calculations it gave the html input element instead of the inputted values the user made

whenever i call for the input in the table i get what you see

let $unitload1 = document.getElementById("unitload1");
let $unitload2 = document.getElementById("unitload2");

let $unitload111 = parseInt($unitload1.value);
let $unitload222 = parseInt($unitload2.value);

//grade tables
// const $selectedGrade;
let grading1 = document.getElementById("courseGrade1");
let grading2 = document.getElementById("courseGrade2");

const $gpa = document.getElementById("gpaprint");
const check1 = "yes ooo";
console.log($unitload111, $unitload222);
<table>
  <tr>
    <td>
      <div contenteditable="true">cve 445</div>
    </td>
    <td>
      <div contenteditable="true">RAW MATERIALS</div>
    </td>
    <td><input type="number" id="unitload1" value="1"/></td>
    <td><input type="number" id="courseGrade1" value="1" /></td>
  </tr>

  <tr>
    <td>
      <div contenteditable="true">cve 945</div>
    </td>
    <td>
      <div contenteditable="true">RAW MATERIALS</div>
    </td>
    <td><input type="number" id="unitload2" value="2"/></td>
    <td><input type="text" id="courseGrade2" value="2" /></td>
  </tr>
</table>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can try to use Number in place of parseInt to cast the String value to number. Example:

let $unitload222 = Number($unitload2.value);
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