It's easy to do that in the keyup
function:
$(document).keyup(function(e) {
if ($(e.target).closest("#excludeMeFromFiring")[0]) {
return;
}
// It's not that element, handle it
});
That's the general case; because input
elements can't have any elements within them, you could just use e.target.id
rather than closest
:
$(document).keyup(function(e) {
if (e.target.id === "excludeMeFromFiring") {
return;
}
// It's not that element, handle it
});
I use closest
whenever the element can have other elements inside it.