简体   繁体   中英

How to get selected name element of kendo MVVM

How to get selected name element of kendo MVVM HTML:

    <select  data-role="multiselect"
                       data-placeholder="Select..."
                       data-text-field="name"
                       data-value-field="name"
                       data-bind="value: sel,
                                  source: list"
                                  ></select>
<label> Selected:</label><span data-bind="text: sel"> </span> 

What should I do in the JS to get value of selected element ?

The value for multiselect is an array so when shown to span, it will show [object object]. You can bind the displayed value to another property and join the array using the change event.

I made a jsFiddle for a quick demo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM