JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Enter minutes you want to work </h1><p>0:00</p>
<input id="request" type="text" value="Enter an amount here">
<a href="#" class="click">Click here</a>
JavaScript
$('.click').click(function () {
var rawAmount = $('#request').val();
var cleanAmount = rawAmount.split(':');
var totalAmount = parseInt(cleanAmount[0] | 0) * 60 + parseInt(cleanAmount[1] | 0);
$('#request').val(" ");
var loop, theFunction = function () {
totalAmount--;
if (totalAmount == 0) {
clearInterval(loop);
}
var minutes = parseInt(totalAmount/60);
var seconds = parseInt(totalAmount%60);
if(seconds < 10)
seconds = "0"+seconds;
$('p').text(minutes + ":" + seconds);
};
var loop = setInterval(theFunction, 1000);
})