user1475477 user1475477 - 1 year ago 107
jQuery Question

Do something when Chosen.js select opens/becomes active?

I'm using the Harvest Chosen plugin on some multi-selects, but can't figure out the right syntax to do something when the chosen dropdown opens/becomes active.

I know I can use .on() to fire events when an item within the menu is selected, but I'm only interested in firing an event when the menu itself has opened.

$('.chosen-select').on('change', function() {

The documentation provides a trigger option for when the dropdowns are open, but I'm not sure how to actually use it, or if it's actually what I'm looking for to begin with:


Answer Source

From their documentation, it looks like you would have to use

$('.chosen-select').on('chosen:showing_dropdown', function (evt, params) {

instead of change.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download