我无法按照我想要的方式设置剑道下拉列表选定项。 到目前为止,这是我尝试过的方法,但它似乎不起作用
<select name="YolTipleri" required
data-value-primitive="true"
data-role="dropdownlist"
data-text-field="Adi"
data-auto-bind="true"
data-value-field="GID"
data-source="Hede.Components.DataSources.YolTipi"></select>
我确实尝试过这样设置,但出现错误
$("#YolTipleri").data("kendoDropDownList").value(2);
它给我错误
Uncaught TypeError: Cannot read property 'value' of undefined
如何设置这个值?
最佳答案
如果你想要不写id的解决方案,你可以使用它
$('[name="YolTipleri"]').data("kendoDropDownList").value(2);
关于javascript - 无法设置 Kendo DropDownList 选定值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49321391/