I've tried use Plus Arithmetic Operation to calculate 2 input text type number values, but my result was the values are "together", like that:
- Value one: 5
- Value two: 5
Result
55
Wanted Result
10
Code
<script type="text/javascript">
function cal(){
var plus = document.getElementById('plus').value,
plus1 = document.getElementById('plus1').value;
var x = plus + plus1;
var result = document.getElementById('result');
if(result.value == ""){
result.innerHTML = "?";
}
else{
result.innerHTML = x;
}
}
</script>
<input type="text" id="plus" /> + <input type="text" id="plus1" /> = <span id="result"></span>
How can I get plus result instead couple of numbers together?