dist/toolkit.js
function(e) {
        var select = $(e.target),
            options = select.find('option'),
            opts = this.options,
            selected = [],
            label = [],
            self = this;

        // Fetch label from selected option
        options.each(function() {
            if (this.selected) {
                selected.push( this );
                label.push( self.readValue(this, opts.getOptionLabel) || this.textContent );
            }
        });

        // Reformat label if needed
        if (this.multiple) {
            var title = this.readValue(select, opts.getDefaultLabel),
                format = opts.multipleFormat,
                count = label.length;

            // Use default title if nothing selected
            if (!label.length && title) {
                label = title;

                // Display a counter for label
            } else if (format === 'count') {
                label = opts.countMessage
                    .replace('{count}', count)
                    .replace('{total}', options.length);

                // Display options as a list for label
            } else if (format === 'list') {
                var limit = opts.listLimit;

                label = label.splice(0, limit).join(', ');

                if (limit < count) {
                    label += ' ...';
                }
            }
        } else {
            label = label.join(', ');
        }

        // Set the label
        select.parent()
            .find(this.ns('label', 'select'))
            .text(label);

        this.fireEvent('change', [select.val(), selected]);
    }
function(e) {
        var select = $(e.target),
            options = select.find('option'),
            opts = this.options,
            selected = [],
            label = [],
            self = this;

        // Fetch label from selected option
        options.each(function() {
            if (this.selected) {
                selected.push( this );
                label.push( self.readValue(this, opts.getOptionLabel) || this.textContent );
            }
        });

        // Reformat label if needed
        if (this.multiple) {
            var title = this.readValue(select, opts.getDefaultLabel),
                format = opts.multipleFormat,
                count = label.length;

            // Use default title if nothing selected
            if (!label.length && title) {
                label = title;

                // Display a counter for label
            } else if (format === 'count') {
                label = opts.countMessage
                    .replace('{count}', count)
                    .replace('{total}', options.length);

                // Display options as a list for label
            } else if (format === 'list') {
                var limit = opts.listLimit;

                label = label.splice(0, limit).join(', ');

                if (limit < count) {
                    label += ' ...';
                }
            }
        } else {
            label = label.join(', ');
        }

        // Set the label
        select.parent()
            .find(this.ns('label', 'select'))
            .text(label);

        this.fireEvent('change', [select.val(), selected]);
    }
function ( e ) { var select = $ ( e . target ) , options = select . find ( 'option' ) , opts = this . options , selected = [ ] , label = [ ] , self = this ; // Fetch label from selected option options . each ( function ( ) { if ( this . selected ) { selected . push ( this ) ; label . push ( self . readValue ( this , opts . getOptionLabel ) || this . textContent ) ; } } ) ; // Reformat label if needed if ( this . multiple ) { var title = this . readValue ( select , opts . getDefaultLabel ) , format = opts . multipleFormat , count = label . length ; // Use default title if nothing selected if ( ! label . length && title ) { label = title ; // Display a counter for label } else if ( format === 'count' ) { label = opts . countMessage . replace ( '{count}' , count ) . replace ( '{total}' , options . length ) ; // Display options as a list for label } else if ( format === 'list' ) { var limit = opts . listLimit ; label = label . splice ( 0 , limit ) . join ( ', ' ) ; if ( limit < count ) { label += ' ...' ; } } } else { label = label . join ( ', ' ) ; } // Set the label select . parent ( ) . find ( this . ns ( 'label' , 'select' ) ) . text ( label ) ; this . fireEvent ( 'change' , [ select . val ( ) , selected ] ) ; }
Event handler for select option changing.

@private
@param {jQuery.Event} e
Event handler for select option changing .