Boa tarde!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Workshop - Desafio</title>
<link rel="stylesheet" type="text/css" href="css/desafio.css" />
</head>
<body>
<label for="valor-hora">Valor Hora</label>
<input type="number" id="valor-hora" />
<label for="horas-projeto">Horas Projeto</label>
<input type="number" id="horas-projeto" />
<span id="resposta">Resposta</span>
<button onclick="calcular()">Calcular Projeto</button>
<a href="index.html">Voltar</a>
<script type="text/javascript" src="js/desafio.js"></script>
</body>
</html>
Tenho esse modelo de HTML pronto e preciso desenvolver o JS para fazer um cálculo para saber o valor total de horas trabalhadas
fiz esse js
var valorH = document.querySelector("#valor-hora")
var horasP = document.querySelector("#horas-projeto")
var resposta = document.querySelector("#resposta")
console.log(valorH)
console.log(horasP)
console.log(resposta)
function calcular() {
var total = valorH.value * horasP
console.log(total)
resposta.textContent = total.toFixed(2)
}
mas o resultado retorna como NaN
vocês podem me ajudar por favor