bootstrap-multiselect
bootstrap-multiselect copied to clipboard
How to trigger the drop down to open?
Is there a way using code to trigger the opening of the drop down? I looked through the methods and didn't see one. I hacked a way by adding the "open" class but was curious if there was a method to do this.
If I could add this as an option to be open when rendered that would be very handy also.
I'm also working around this by simulating a click event on it.
I had the same issue, although I found a workaround for this: $("elementId").dropdown('toggle') but it doesn't open in the appropriate position.
any updates?
Since this repo hasnt been updated in close to 2 years, I didn't create a PR for this, but...
I added the following as a function to the codebase:
/**
* Toggles open/closed the dropdown
*/
toggle: function () {
this.$button.click();
},
And toggle it open/closed by calling $("elementId").multiselect("toggle").
this.$button.click() is how this plugin handles opening and closing the dropdown. So seemed the appropriate approach.