JSFiddle - React, Tailwind, and code Playground

by Chase Wilson

HTML

<div>
<p>Click</p>
</div>

JavaScript

Element.Events.shiftclick = {
    base: 'click', // the base event type
    condition: function(event){ //a function to perform additional checks
        return (event.shift == true); // this means the event is free to fire
    }
};
 
$$('div').addEvent('shiftclick:relay(p)', function(event){
    alert('the user clicked the left mouse button while holding the shift key');
});

$$('div').addEvent('click:relay(p)', function(event){
    alert('the user clicked the mouse button.');
});