I tried to check if a clicked element has a class, to decide what I need to do. For me the following code won't work. I tried a lot of variations which all failed.
$(window).click(function(e) {
//console.log(e);
//if ($(e).is('.lookingfor'))
//if ($(this).is('.lookingfor'))
if ($(e).hasClass('lookingfor')) {
alert('matched');
} else {
alert('wrong class');
}
});