JSFiddle - React, Tailwind, and code Playground

by tabalinas

HTML

<button id="clearLog">Clear log</button>
<div id="test"></div>
<div id="log"></div>

CSS

#test { height: 100px; width: 100px; border: 1px solid red; }
#log { font-size:10px; line-heght: 1em; }
#clearLog { float: right; }

JavaScript

$("#test").on("touchstart mousedown click", function(e){   
    if(e.type === "mousedown") {
        e.preventDefault();
    }
    $("#log").append("<div>" + e.type + "</div>");
})

$("#clearLog").click(function() {
    $("#log").empty();
})