I want to have my menu closed when the user clicks outside the menu, not only outside the navbar element. Because I have more collapses in my menu, this solution did not wor
You can use this to collapse if not clicking a link: fiddle
$(document).click(function(e) { if (!$(e.target).is('a')) { $('.collapse').collapse('hide'); } });