How to listen for the clearBtn click?
ericel opened this issue · 3 comments
I want to listen to when the clear button of a selected button is clicked. Or even better, How can I listen for change that involves both selection and desellection?
I initialised the plugin as so:
$('#job_city').filterMultiSelect();
This works fine, but I don't know how to go about listening for a change in the plugin
Edit: see my comment below.
Hi Oj-
Currently, there is no functionality for this use case. This can be a future enhancement. Feel free to submit a pull request!
Best,
-Andrew
Hi Oj-
See v1.2.0.
The plugin now fires optionselected
and optiondeselected
events when an option is selected and deselected, respectively. You can poll the event object for the option label, value, and select element name.
$('#job_city').on('optionselected', function(e) {
console.log(e.detail.label);
console.log(e.detail.value);
console.log(e.detail.name);
});
@andreww1011
THanks for the quick update. I will check it out and close the issue.