JSFiddle - React, Tailwind, and code Playground

by redler

HTML

<button id="start">Start</button>
<button id="reset">Reset</button>
<input id="counter" value="233"/>

JavaScript

$(function ()
{
    var $start = $('#start'),
        start = $start.get(0),
        $reset = $('#reset'),
        reset = $reset.get(0),
        $counter = $('#counter'),
        startVal = $counter.val(),
        currentVal = startVal,
        endVal = 250,
        prefix = '$';
    
    $start.click(function ()
    {
        this.disabled = true;
        var i = setInterval(function ()
        {
            if (currentVal === endVal)
            {
                clearInterval(i);
                reset.disabled = false;
            }
            else
            {
                currentVal++;
                $counter.val(prefix+currentVal);
            }
        }, 100);
    });
    
    $reset.click(function ()
    {
        $counter.val(prefix + startVal);
        this.disabled = true;
        start.disabled = false;
    }).click();
});