Skip to content

How to get the last selected item #34

@harmancode

Description

@harmancode

I am trying to get the last selected item by listening to the select2:select event as suggested here, but I could not make it work.

Is this kind of event listening not supported?

$('#mySelect2').on('select2:select', function (e) {
  // Do something
});

This does not work either:

$(document).on('select2:select', '#mySelect2', function (e) {
  // Do something
});

But this works:

$('#mySelect2').change(function (e) {
  // Do something
});

(select2 version 4.x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions