[jQuery] calling a function when you click off an element

[jQuery] calling a function when you click off an element


for example, in Google docs, you can pop up a little menu (eg: actions
menu), now when you click back onto the webpage some where, the
dropdown menu disapears. I'm wondering, how can this be easily done.
I've looked at the source code, and it seems that they have added
<body onclick="hideMenu();">, i've personaly tried this doing it this
way:
$('body').bind('click',function(){
doHidingCodeHere();
});
but that just stops the menu from apearing full stop.
Any ideas.