I just want to add the values I get in input
, what's the problem with the code?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript">
function calcula(){
var soma = document.getElementsById('valor').value;
var total =0;
total+= soma;
document.getElementById("resultado").innerHTML = total;
}
</script>
</head>
<body>
<input type="text" name="valor">
<button id="calc" onclick="calcula()">Soma</button>
<h3 id="resultado"></h3>
</body>
</html>