使用AjaxChosen的事件处理程序

I'm trying to use this jquery plugin: https://github.com/meltingice/ajax-chosen I have a multiple select and I would like to know which event is called when someone deletes a value or when someone choses a value.

Here's what I've done:

$("#firmsSelect").ajaxChosen({.....}).change( function (event) {
 console.log($(event.currentTarget));
})

I would like to know what can I do whith the currentTarget object. (I tried .val() but the valueI get is for the entire select , aka an array, whereas I just want the value of the element that was deleted/selected.

I had the same problem. First I solved it with something like the following code:

$("#mySelect").chosen().change(function (event, params) {
 //...
})

then you can use:

var selectedValue = params.selected;

But this does not solve everything, for example when you deselect then property selected is undefined, so you can't get the value of the item that has just been deselected.

Eventually I used something like:

var options = $(evt.currentTarget).find('option');

The array "options" contains all your <options> tags within the <select> tag. You can then iterate over the items and, with some bookkeeping, know the item that has been deselected.

I hope this helps.