DJM
DJM

Reputation: 624

bootstrap-multiselect, getting selected text

How to get the selected text in the bootstrap-multiselect.

In the onChange function, it comes with the value, and the text when I use

var selectedText = $( "#id_multiSelect option:selected" ).text();

It shows all the selected without any space.

Upvotes: 1

Views: 3906

Answers (1)

Mac
Mac

Reputation: 181

You can iterate the selected option.

Here is an example:

$("#id_multiSelect option:selected").each(function() {
    console.log(this.text); //this will give you the selected text values one by one ... to get value use this.value in place of this.text
});

Upvotes: 1

Related Questions