Déclencher une action après la sélection select2

Je suis en utilisant select2 bibliothèque pour ma recherche.

est-il possible de déclencher une action après la sélection d'un résultat de recherche? par exemple, ouvrir une fenêtre, ou une simple js alerte.

$("#e6").select2({
    placeholder: "Enter an item id please",
    minimumInputLength: 1,
    ajax: { //instead of writing the function to execute the request we use Select2's convenient helper
        url: "index.php?r=sia/searchresults",
        dataType: 'jsonp',
        quietMillis: 3000,
        data: function (term, page) {
        return {
            q: term, //search term
            page_limit: 10,
            id: 10
            };
        },
        results: function (data, page) { //parse the results into the format expected by Select2.
            //since we are using custom formatting functions we do not need to alter remote JSON data
            return {results: data};
        },
    },

    formatResult: movieFormatResult, //omitted for brevity, see the source of this page
    formatSelection: movieFormatSelection, //omitted for brevity, see the source of this page
    dropdownCssClass: "bigdrop", //apply css that makes the dropdown taller
    escapeMarkup: function (m) { return m; } //we do not want to escape markup since we are displaying html in results
});
  • Vous pouvez lier à la "changer" de l'événement, il y a une section "Événements" sur le lien que tu as donné avec un très long extrait de code pour toutes les différentes liaisons d'événements.
InformationsquelleAutor spyfx | 2013-09-04