0
I have the following very simple javascript code, however, I would like to know pq the return result is being NAN? HTML:
<label for="pretensaoMes">Pretensão ao Mês</label>
<input type="text" id="pretensaoMes">
<label for="diasPorMes">Dias por Mês</label>
<input type="text" id="diasPorMes">
<label for="horasPorDia">Horas por Dia</label>
<input type="text" id="horasPorDia">
<button id="btn">Clique</button>
<p id="result">Nenhum resultado</p>
And the JS:
var btn = document.getElementById("btn");
var PM = document.getElementById("pretensaoMes");
var PMINT = PM.value;
var pm = parseInt().PMINT;
var DM = document.getElementById("diasPorMes");
var DMINT = DM.value;
var dm = parseInt().DMINT;
var HD = document.getElementById("horasPorDia");
var HDINT = HD.value;
var hd = parseInt().HDINT;
var horaTrabalho = pm + dm + hd;
var tanto = horaTrabalho;
var result = document.getElementById("result");
btn.addEventListener("click", function(){
result.innerHTML = tanto;
})
JS runs after loading gives page ? What would be through the
onload
of<body>
or being placed at the end of<body>
– Isac
Inside the <body></body>
– LeAndrade