Usually when I want to check if any child element inside a parent element was clicked I use something like this:
$(document).click(function (e) {
alert($(e.target).is("#somediv *"));
}
But now I have the somediv
in a variable. I have tried:
var somediv = $(this);
$(document).click(function (e) {
alert($(e.target).is($(somediv, "*")));
}
But it doesn't work. How can I do that? Is it the best way to detect if a element or any child element was clicked?