How can I get hold on the <option>
that was just selected when listening to the select2:select
event? Note that this is simple when using a single-select, as when only one option is selected, that must be the one that was just selected. I would like to also be able to find the option that was just selected when using a multiple-select (<select multiple>
).
In the select2:unselect
event, the unselected <option>
is available through e.params.data.element
, but it is not so in the select2:select
event. I do not see a reason why the <option>
should not be available, since it is created at this time. For the select2:selecting
event, however, the <option>
is not yet created, and obviously cannot be available when the event is fired.