I can not make the output number bigger than one when I click a button I a using the +1 operator.
I have search everywhere but just can not find a easy and good solution.
<script>
function more() {
document.getElementById("more").innerHTML = +1; //plus one
}
</script>
<p>You have </p>
<a href="#" id="more" class="list-group-item disabled">0 </a>
<img src="coin.png" width="2%" alt="coins">
<button onClick="more()">More!</button>//the button
When you post a question try to post just what's needed. Your php doesn't really add anything to the problem. First get sum, then increase it by 1, then set innerHTML
function more() {
let sum = document.getElementById("more").innerHTML
sum++
document.getElementById("more").innerHTML = sum
}
<p>You have </p><a href="#" id="more" class="list-group-item disabled">0 </a>
<button onClick="more()">More!</button>