I'm having a ton of trouble trying to get simple jquery functionality to work. All I want is to be able to click on a menu button and have a menu pop up and click outside of it to close it. I think the problem may have to do with the parent to child structure of my code. Please offer any advice into what I may be doing wrong.
<div id = "outer-screen">
<div id = "screen-container">
<div id = "screen">
<div id = "menu-container">
</div>
<div id = "bottom-panel">
<div id = "menu-button">
Menu
</div>
</div>
</div>
</div>
$("#menu-button").click(function(){
$("#menu-container").show();
});
})
$('body').click(function(e){
if ( e.target.id == 'menu-container'){
return true;
}else{
$('#menu-container').hide();
}
})