Question

I have this javascript function and a kendo UI multiselect, it returns the list of the selected items in a string

(item1,item2,item3)

And I want to put all these elements into an array, so I am using split function in javascript.

$("#areaMultiCommandSubmit").click(function (e) {
        e.preventDefault();
        var multiselect = $("#runMultiCommandsFormMultiselect").data("kendoMultiSelect");
        var selected = multiselect.value();
        var myarray = selected.split(',');
        alert(myarray[1]);
    })

Unfortunatly, that doesn't work. Any ideas please ?

Was it helpful?

Solution

The problem was obvious. I shall parse the returned result to string then split it.

e.preventDefault();
    var multiselect = $("#runMultiCommandsFormMultiselect").data("kendoMultiSelect");
    var selected = multiselect.value();
    alert(selected);
    var myarray = selected.toString().split(',');
    alert(myarray[1]);

Just corrected that and it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top