JSFiddle - React, Tailwind, and code Playground

by docluv

HTML

<div id="hitme">Hit Me</div>

CSS

#hitme{
    
    font-size:2em;
    font-weight: bold;
    padding:.5em;
    background-color:#c30000;
    
}

JavaScript

function foo(e){
 
    e.preventDefault();
    console.info("clicked: " + this.bar);
    
}

var myObj = {

    bar : "The button"
};
    
var hitme = document.getElementById("hitme");
    
    hitme.addEventListener("click", foo.bind(myObj));