JSFiddle - React, Tailwind, and code Playground

by yijiang

HTML

<div id="clicker">Up!</div>

<p id="log"></p>

CSS

#clicker {
    width: 100px;
    height: 100px;
    background: #efefef;
}

JavaScript

var timeout;
var clicker = $('#clicker');


clicker.mousedown(function(){
    timeout = setInterval(function(){
        var text = $('#log').html();
        $('#log').html(text + "Up! <br />");
    }, 500);
});

$(document).mouseup(function(){
    clearInterval(timeout);
});