I have a textbox on which a keyup
eventlistener is attached which is a JavaScript function, say exec()
. Now the exec()
method should not get called if some keys are pressed such as:
ctrl+ anything,
shift+anything,
alt+ anything.
Can someone guide me how do it?
You want to check some of the properties of the events.
textbox.onkeyup = function (e) {
if (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) return;
exec();
}