JSFiddle - React, Tailwind, and code Playground
by nathanlogan
HTML
<a href="#">Click me!</a>
<p>Was there a potentially click-altering key pressed at time of click?!?</p>
<div></div>
CSS
body {padding:10px;}
p {padding:10px 0;}
div {display:none;}
JavaScript
$('a').click(function(e){
var result = 'Yes!';
if (!e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
result = 'No!';
}
$('div').text(result).show();
return false;
});