I have a kendo ui dropdownlist in my view:
$("#Instrument").kendoDropDownList({ dataTextField: "symbol", dataValueField: "symbol", dataSource: data, index: 0 });
How can I change the selected value of it using jQuery? I tried:
$("#Instrument").val(symbol);
But it doesn't work as expected.
If your KendoDropdown has a change event, you must trigger it manually by calling dropdownlist. trigger("change"); after calling select .
If you click on button the multi-value input gets: name1 , name2 and name6 . EDIT If you want to add to current selected values then do: $("#button"). on("click", function () { var selected = multiselect.
$("#CATEGORY_CODE"). data("kendoDropDownList"). select(0);
You have to use Kendo UI DropDownList select
method (documentation in here).
Basically you should:
// get a reference to the dropdown list var dropdownlist = $("#Instrument").data("kendoDropDownList");
If you know the index you can use:
// selects by index dropdownlist.select(1);
If not, use:
// selects item if its text is equal to "test" using predicate function dropdownlist.select(function(dataItem) { return dataItem.symbol === "test"; });
JSFiddle example here
The Simplest way to do this is:
$("#Instrument").data('kendoDropDownList').value("A value");
Here is the JSFiddle example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With