JSFiddle - React, Tailwind, and code Playground

by bluey

HTML

<script src="http://remysharp.com/demo/mousehold.js"></script>
<button id='btn'>Go</button>
<span id='1'>0</span>

JavaScript

var timer;
$('#btn').mousehold( function() {
    var num = $('#1').text();
    num = parseFloat(num) + 1;

    $('#1').text(num); 

    clearTimeout(timer);
    timer = setTimeout(function(){
        alert('derp');
    },1000);

});