select2-multi-checkboxes icon indicating copy to clipboard operation
select2-multi-checkboxes copied to clipboard

maximumSelectionSize not working

Open sebackend opened this issue 7 years ago • 0 comments

Trying to set a limit for selected elements with the option maximumSelectionSize is not working even if i overwrite the plugin:

$('#my-select').select2MultiCheckboxes({
  maximumSelectionSize: 2 // THIS IS NOT WORKING
})
$.fn.extend({
    select2MultiCheckboxes: function() {
      var options = $.extend({
        placeholder: 'Choose elements',
        maximumSelectionSize: 2, // THIS IS NOT WORKING
        formatSelection: function( selected, total ) {
          return selected.length + ' > ' + total + ' total';
        },
        wrapClass: 'wrap'
      }, arguments[ 0 ] );

      this.each(function() {
...

I'm using the 3.5.2 version of select2

sebackend avatar Jan 02 '18 15:01 sebackend