I would like to be able to do a quick calculation where I add the contents of a div and input. I can do this with 2 inputs but can't figure out how to do it this way. My attempts at coding have got me here:
var one = document.getElementById('one'),
two = document.getElementById('calculate'),
total = document.getElementById('total');
document.getElementById('calculate').onchange = function() {
total.innerHTML = parseInt(one.innerHTML) + parseInt(two.innerHMTL);
};
<div id="one">11</div>
<input type=number value=2 id="calculate">
<div id="total">0</div>
I tried changing "parseInt(two.innerHTML)" to "parseInt(two)" but it was unsuccessful. I get the NotANumber/NaN error. Any help would be greatly appreciated.