Calvin Cheng Calvin Cheng - 4 months ago 5x
Javascript Question

Closing the dropdown button programmatically

I am using this zurb-foundation dropdown button -

But I have an additional requirement to close the dropdown list when a user clicks outside the dropdown button itself or when the user clicks on an item in the dropdown list, so I need a way to programmatically close an open dropdown list on an on-click event.

What's the javascript call I need to make to programmatically close an open dropdown list?


After some searching here is a slightly cleaner way of doing it: