Reputation: 8020
I have such a dropdown menu:
It works fine, but I need to add a manual Close
button to it similar to this:
so that the Dropdown closes just like I would have clicked anywhere else on the page.
I looked at Bootstrap manuals and searched Google, but couldn't find a solution for this.
Any ideas?
Upvotes: 0
Views: 4148
Reputation: 6863
You might want to try the following (put this in an on-click
):
$('[data-toggle="dropdown"]').parent().removeClass('open');
Hence, your button would look like:
<button onclick="$('[data-toggle="dropdown"]').parent().removeClass('open');"> x </button>
Upvotes: 2