Is there a way to automatically close an open collapsed navbar by clicking outside of the navbar element? It's currently only possible to open or close it by clicking on the navbar-toggle button.
For an example and code, click here.
I've attempted the following solution but it doesn't seem to be effective:
$(document).ready(function () {
$(document).click(function () {
$('.navbar-collapse').collapse('hide');
});
});
Unfortunately, the above method is not working as intended.