Jaylen
Jaylen

Reputation: 40311

How can I change the selected text when using Multiple Select jQuery plugin

I am using this cool Multiple Select plugin

Please look at "The Position" options. I would need to display either 1 text or 5 of 12 selected.

so If I only select 1 option then display that option if I select more than 1 then just state 2 of 12 are selected.

It seems that the default here is set to 4 and I need to override this.

How can I change the default value?

Here is my code

$(function(){                                           
   $(".multipleSelectMenuMask").multiselect({
   enableFiltering: true,
   enableCaseInsensitiveFiltering: true,
   selectedClass: null,
   nonSelectedText: "Select an option",
   includeSelectAllOption: true,
   buttonWidth: "100%",
   maxHeight: 250
   });
});

Upvotes: 3

Views: 11186

Answers (4)

Alexandru Sirbu
Alexandru Sirbu

Reputation: 189

use Bootstrap multiselect here

$(".example-class-multiselect").multiselect({
    nonSelectedText: "Select an option",
    allSelectedText: "Selected all",
    nSelectedText  : "Selected",
    //...
});

Upvotes: 1

Apache
Apache

Reputation: 105

Bower get not last version of plugin. Check your sources:

Line 245: } else if (selects.length > this.options.minumimCountSelected && this.options.countSelected) {

and

Line 443: minumimCountSelected: 3,

minUmIm

Now you can change option name to minumimCountSelected and temporary fix it in version 1.1.0.

Upvotes: 0

Jaylen
Jaylen

Reputation: 40311

I figured out the problem.

I am using bootstrap-multiselect not Multiple Select plugin

the option is

numberDisplayed

Upvotes: 2

Ragnar
Ragnar

Reputation: 4578

Take a look at constructor http://wenzhixin.net.cn/p/multiple-select/docs/#constructor

minimumCountSelected

Type: int

countSelected will be shown only if more than X items where selected.

By default this option is set to 3.

Upvotes: 0

Related Questions