JSFiddle - React, Tailwind, and code Playground

HTML

<div id="timerBar" class="progress"></div>

<a href="#" id="hesapla" class="btn btn-default btn-lg">Default</a>

JavaScript

function headerBar() {
    var progressbar = $('#timerBar');
    progressbar.progressbar({
        value: 100
    });

    function progress() {
        var val = progressbar.progressbar('value') || 0;
        progressbar.progressbar('value', val - 1);
        if (val > 0) {
            setTimeout(progress, 300);
        }
        else
        {
        alert("bitti");
        }
    }
    progress();
}
headerBar();
setInterval(function () {
    headerBar();
}, 6 * 1000);

	$('#hesapla').click(function(){
		alert(progressbar.progressbar('value'));
	});