I have a fiddle for my project. I'm making a responsive navigation with dropdown menus. I currently have the dropdown items set to toggle when you click them. However, I'd like the dropdown to close if you click anywhere away from it.
I tried copying the code from a similar question, but it isn't working for me. I included it in the fiddle, but commented out so you can see the dropdowns work.
$(document).click(function(){
$(".nav-dropdown").hide();
});
$(".nav-dropdown").click(function(e){
e.stopPropagation();
});