JSFiddle - React, Tailwind, and code Playground

by kflorence

HTML

<div id="clickMe">click me</div>
<div id="result"></div>

CSS

#clickMe {
    background-color: #eee;
    border: #000 1px solid;
    cursor: pointer;
    padding: 25px;
    text-align: center;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

#result {
    padding-top: 10px;
    text-align: center;
}

JavaScript

var end, start;
jQuery('#clickMe').on('mousedown', function(e) {
    start = new Date();
}).on('click', function(e) {
    end = new Date();
    $('#result').text((end.getTime() - start.getTime()) + 'ms');
});