Skip to content

maximumSelectionSize not working #13

@sebackend

Description

@sebackend

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

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