<img src="" alt="" title="" />
View source code:
<div id="example">
<img data-bind="attr: { src: imageSrc, alt: imageAlt, title: imageTitle }" />
<label>src:<select data-text-field="name" data-value-field="url" data-bind="source: food, value: imageSrc" ></select></label>
<label>alt:<input type="textbox" data-bind="value: imageAlt" /></label>
<label>title:<input type="textbox" data-bind="value: imageTitle" /></label>
</div>
View model source code:
var viewModel = kendo.observable({
imageSrc: null,
food: [
{ name: "Mishi Kobe Niku", url: "../../content/web/foods/9.jpg" },
{ name: "Chef Anton's Cajun Seasoning", url: "../../content/web/foods/4.jpg" },
{ name: "Queso Manchego La Pastora", url: "../../content/web/foods/12.jpg" },
],
imageAlt: "Alt attribute value",
imageTitle: "Title attribute value"
});
viewModel.imageSrc = viewModel.food[0].url;
kendo.bind($("#example"), viewModel);