3

All the example and uses of Kendo UI Multiselect I've seen so far use 'id' instead of 'class' name in the html

I tried using class name but it doesn't seem to work. Am I doing something wrong or Kendo doesn't support this?

HTML:

<select class="multiselect" kendo-multi-select k-options="selectOptions">

Scipt:

const multiselect = $(".multiselect").data("kendoMultiSelect");
const value = multiselect.value();

This is the error I get:

TypeError: Cannot read property 'value' of undefined
roro
  • 193
  • 3
  • 16

1 Answers1

4

You will need to use a more specific selector because the controls are wrapped.

var mymultiselect = $(".multiselect[data-role=multiselect]");

mymultiselect.each(function(idx, input) {
     var myselect= $(input).data("kendoMultiSelect");

     alert("Value: " + myselect.value() );
})  
Rick S
  • 6,476
  • 5
  • 29
  • 43