0
I cannot understand why this mistake is happening. Theoretically the error is due to not having this ID in html, but it exists... until I changed the name to check if something was misspelled...
<tr class="paciente">
<td class="info-nome">Paulo</td>
<td class="info-peso" id="peso-2">100</td>
<td class="info-altura" id="altura-2">2.00</td>
<
See the J...
var tdpeso = document.getElementById("peso-2");
var tdaltura = document.getElementById("altura-2");
var peso = tdpeso.textContent;
var altura = tdaltura.textContent;
if (altura != 0) {
var imc = peso / (altura * altura);
console.log(imc);
}else{
console.log("Impossível executar pois altura é igual a zero");
}
In your HTML you have
<
in the end, can you correct? maybe it’s</tr>
? Question: where is Javascript on the page?– Sergio