I want to create an effect like in facebook when you have opened a menu with options, help and logout. It works this way.
wherever you click on the page except of that menu, it closes.
I have tried this
$("body").not("#myMenu").click(function() {
// hide menu
});
but this fails, because it hides hides menu when I am clicking it. What can be the problem and how to solve it?
May be there are other ideas how to handle that?
I think this post should help you out:
How do I detect a click outside an element?
The key is
stopPropagation().