JavaScript how to hide a DIV when the user clicks outside of it?

 var hideMe = document.getElementById(hideMe); document.onclick = function(e){ if(e.target.id !== hideMe){ hideMe.style.display = none; }};