I want to write Javascript code which can increase a number when we click a button.Can you help me? I tried this but it doesn't work.
var document.getElementById("par").innerHTML = i;
function sum(){
i++;
}
<p id="par">1</p>
<img onclick="sub()" height="40px" width="40px" src="sub.png">