Im beginner at JS and I have stucked on this problem. I have tried and read on google and other people with almost same issue but I cant make this work.
var start = 0;
// Add number
var total = document.getElementById('div1').innerHTML += start;
document.getElementById('divResult').innerHTML = total;
That code is in a button click function. The value start at 0. And every time press the button, the value from div1 is + in divResult.
so if div1 contain the value 10 then divResult should be +10 every time button is pressed. The value in div1 is dynamic.
Now that code just do "101001010010" Just keeps adding 1 and 0 when press the button.
10
Result
` – Jijo Robin Sep 23 '19 at 10:38