TypeError: document.getElementsById is not a function [closed]

2

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>
    
asked by anonymous 12.08.2016 / 00:18

1 answer

1

The problem lies in this line. has an S where it should not:

var soma = document.getElementById('valor').value;
    
12.08.2016 / 00:23