Close Bootstrap Dropdown after link click
Close Bootstrap Dropdown after link click
Provide a class to the links (e.g. download):
<a href="#" class="download" data-bind="disable: noResults()....
Make the dropdown an id (e.g. dlDropDown):
<button class="btn dropdown-toggle" id="dlDropDown" data-toggle="dropdown" data-bind="enable: !noResults()">
Finally include a event handler:
$("a.download").click(function() { $("#dlDropDown").dropdown("toggle"); });
It work finely with old bootstrap markup without any class or id. But it help to provide a solution in without changing anything old.
$(".dropdown-menu a").click(function() { $(this).closest(".dropdown-menu").prev().dropdown("toggle"); });
This code reduce the dropdowns and increase navmenus on the page
$('.in,.open').removeClass('in open');