Hide menu when user clicks outside of the button?

obenoben

New Member
I have tried many different solutions but none have worked. My way of doing this is a bit different from everyone else's and I think that's why theirs wont work for me. I have this:\[code\] function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; }\[/code\]I want to make the pulled down menu disappear not only when you click on the button again to close it, but also when you click anywhere else outside. Thank you in advance.
 
Back
Top