.is() , - jQuery.
However, for what you are trying to do, you should only pass a selector instead of a function .is()as follows:
if (e.keyCode === 27 || !$(e.target).is("#req, #hideshow1")) {
$("#req").hide()
}
Here is a working jsFiddle . (Note that this will not work if you click to the right of the div, but that is because you are still clicking on #reqbecause it does not have the specified width.)
source
share