I'm trying to create a menu where when a div is clicked it opens another div with the contents. I wanted it close when the user clicked anywhere else. That part seems to work, however it also closes when the div itself is clicked.
The user should be able to click inside the div without it closing,
I was using answers from this question as a guide but they were using ordered lists instead of divs, is there an issue with e.target.class ?
Thanks for any help.
$('.trigger').click(function (e) {
e.stopPropagation();
$('.header-menu-container').hide();
$(this).next('.header-menu-container').slideDown();
});
$(document).click(function (e) {
if (e.target.class == 'header-menu-container' || e.target.class == 'header-menu-contents')
return;
$('.header-menu-container').slideUp();
});
Please see here: http://jsfiddle.net/75JaR/3/