JSFiddle - React, Tailwind, and code Playground

by ovfiddle

HTML

<a href="http://google.com" id="a-ignore">I ignore `command` key</a><br/>
<a href="http://google.com" id="a-respect">I respect `command key</a>

JavaScript

$('#a-ignore').click(function(e){
    //pretend to do ajaxy stuff
    e.preventDefault();
    console.log("#a-ignore handled a click");
});
$('#a-respect').click(function(e){
    if (e.metaKey || e.ctrlKey) return;//ignore the click handler if ctrl-clicked/command-clicked
    //pretend to do ajaxy stuff
    e.preventDefault();
    console.log("#a-respect handled a click");
});