I am trying to detect changes on a JQuery MultiSelect to trigger an update in another place. The normal javascript on change stuff does not work because the select does not change. I found a method called “beforeclose” that is called from the close function of the MultiSelect. I think I can use that. I found that if I add it when making the MultiSelect it works as expected and logs the message when closing the select. See bellow:
$j("#selectId").multiselect({
checkAllText: 'Select all',
uncheckAllText: 'Deselect all',
beforeclose : function() {
console.log("before close")
}
}).multiselectfilter();
But I can not do this because the MultiSelect is created some other place, so I need to just add that method to it. I tried lots of different things like:
$j("#selectId").multiselect().data("ech-multiselect").beforeclose = function() {
console.log("before close")
};
But nothing seems to work. Any ideas? Thanks