JSFiddle - React, Tailwind, and code Playground

by sOoN92

HTML

<button class="entry">
PRESS DOWN FOR 1SEC
</button>

JavaScript

var pressTimer;

$(".entry").mouseup(function(){
  clearTimeout(pressTimer);
  // Clear timeout
  return false;
}).mousedown(function(){
  // Set timeout
  pressTimer = window.setTimeout(function() {
  console.log("hi!")
  },1000);
  return false; 
});