JSFiddle - React, Tailwind, and code Playground
by ilazarte
HTML
<div id="targets">
<a href="#" tabindex="0" id="first">this is the first item</a>
<a href="#" tabindex="0" id="second">this is the second item</a>
</div>
JavaScript
var handler = function(event) {
var node = event.target;
var type = event.typel;
var which = event.which;
var metaKey = event.metaKey;
var $el = $(node);
console.log("we got an event (" + type +
") on " + node.tagName +
" => " + node.id +
"which:" + which +
", metaKey:" + metaKey);
if (type == "click") {
event.preventDefault()
}
}
$("#targets").on("click focus dblclick", "a", handler)