Q:

Passing an option when a Select element is clicked

I have a jsFiddle here - http://jsfiddle.net/hL7Lnf3a/3/ - with a select dropdown menu of files. When a file is selected from the menu the .change() handler is entered. I'd like to let the user somehow tell me when they select a file that instead of loading the file, they want to delete it. This could be by holding down the Shift key, or some other key when they click the entry in the menu, or even by right-clicking instead of left-clicking the entry.  But the browser (I'm running Chrome) doesn't seem to set any of these indications for a .change event. That is, I don't see e.shiftKey or e.which being set in the event object when change event fires.  Does anyone see a way to let the user tell me whether they want to load or delete the file they're selecting?
Thanks?

A:

You can have another listeners (keyup and keydown) for the shift key. 
Use a flag variable to denote whether the key is pressed or not, and then in your change listener simply check for the state of that flag variable.
Something like this: 
var shiftPressed = false;

$(document).keydown(function(e){
    if (e.keyCode == 16)
        shiftPressed = true;
})

$(document).keyup(function(e){
    if (e.keyCode == 16)
        shiftPressed = up;
})

See it here: http://jsfiddle.net/hL7Lnf3a/5/ (try changing the select item with and without the shift pressed)

A version with a custom drop-down menu: http://jsfiddle.net/g8ptz2eb/11/

