Q:

How to add mouseup event jquery

I am creating an "mousedown" event on an element and toggling a variable if shift key is pressed down. I also want to make the variable false when the "mouseup" event occurs.
element.addEventListener("mousedown", (e)=>{
            if(e.shiftKey){
                this.start = true;
            } else {
                this.start = false;
            }
        });

I want to make the this.start to false when the mouseup occurs subsequently after the above code. Could anyone help me out with it.
Thank you.

A:

Firstly listen for key presses on Shift 
var shiftIsPressedDown = false;
$(window).keydown(function(evt) {
  if (evt.which == 16) { // shift
    shiftIsPressedDown = true;
  }
}).keyup(function(evt) {
  if (evt.which == 16) { // shift
    shiftIsPressedDown = false;
  }
});

Then look into the mouse down event 
$( "#target" ).mousedown(function() {
   if(shiftIsPressedDown){
     // Do logic here     
   }
});

