Reputation: 213
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
Upvotes: 3
Views: 1009
Reputation: 6586
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() );
})
Upvotes: 4