Close Bootstrap Dropdown after link click
Give your links a class (e.g. download):
<a href="#" class="download" data-bind="disable: noResults()....
And your dropdown an id (e.g. dlDropDown):
<button class="btn dropdown-toggle" id="dlDropDown" data-toggle="dropdown" data-bind="enable: !noResults()">
And then add the following event handler:
$("a.download").click(function() {
$("#dlDropDown").dropdown("toggle");
});
This will actually work with your existing bootstrap markup without having to add any new classes or ids. Hopefully this is helpful to someone else just looking to drop a solution in without changing anything existing.
$(".dropdown-menu a").click(function() {
$(this).closest(".dropdown-menu").prev().dropdown("toggle");
});