JSFiddle - React, Tailwind, and code Playground

by hicurin

HTML

<span id="spnTest">0</span>
<button id="btnTest" onclick="decrease();">Decrease</button>

JavaScript

var ratio = 5;
var totalValue = 500;

function decrease(){
    alert('ok');
    if(totalValue == 0) return;
    totalValue -= ratio;
    document.getElementById('spnTest').innerHTML = totalValue;
}