Bootstrap: Feature Request: Close dropdown with JavaScript $().dropdown('close')

Created on 15 Jun 2017  路  2Comments  路  Source: twbs/bootstrap

Feature Request: Add support for closing dropdowns through the JavaScript API

There is one JS method for dropdowns:

$().dropdown('toggle')  // Toggles the dropdown menu of a given navbar or tabbed navigation.

docs: https://v4-alpha.getbootstrap.com/components/dropdowns/#methods

Though the alert component is not exactly a parallel, I think this would provide some consistency to the API, which provides a way to close alerts:

$().alert('close')  // Closes an alert by removing it from the DOM. If the .fade and .show classes are present on the element, the alert will fade out before it is removed.

docs: https://v4-alpha.getbootstrap.com/components/alerts/#methods

Further, modals provide a similar close ('hide') feature.

docs: http://v4-alpha.getbootstrap.com/components/modal/#methods

feature js v4

Most helpful comment

IMHO it would be good to have explicit open & close methods in addition to toggle.

All 2 comments

IMHO it would be good to have explicit open & close methods in addition to toggle.

100% agree with the above, having open/close in addition to "toggle" (which should toggle instead of just open). I spent 30 minutes debugging what i thought was my bad code only to find out that "toggle" doesn't really mean "toggle" in this case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

athimannil picture athimannil  路  3Comments

ziyi2 picture ziyi2  路  3Comments

eddywashere picture eddywashere  路  3Comments

bellwood picture bellwood  路  3Comments

MrCsabaToth picture MrCsabaToth  路  3Comments