I have trouble with javascript. I want to make it so that if I click on the adding candy button. It states There are 2 candy. If I click again it says There are 3 candy. What is the fastest way to do it using innerHTML?
function add() {
var d = document.getElementById('idd').innerHTML;
d = d + '<li>There is a candy</li>';
document.getElementById('idd').innerHTML = d;
}
<body>
<h1>Adding</h1>
<p><input type="button" value="adding candy" onclick="add();"></p>
<ul id="idd">
<li>There is a candy.</li>
</ul>
</body>
This is giving me a head ache all day long.