Example 24: (Open the Dev Console and check the Log)

This example show you how to:

  • Load the plugin
  • Return the Selected ids and the Selected labels when close the mSelect

HTML:
<select id="country_id" class="mSelect" multiple="multiple"></select>
JS:
$(function () {
    $('#country_id').mSelect({
        url: 'ajax/example1.php',
        returnSelectedLabels: {  // Activate the return of the selected labels
            enable: true
        },
        onDropdownHide: function(selectedIds, selectedLabels) { // callback functions
            console.log('the mSelect is closed');
            console.log('------- The selectedIds ---------');
            console.log(selectedIds);
            console.log('------- The selectedLabels ------');
            console.log(selectedLabels);   
        }
    });
});