template String|Function

The template used to render the suggestions. By default the widget displays only the text of the suggestion (configured via dataTextField).

Example - specify template as a function

<input id="autocomplete" />
<script id="template" type="text/x-kendo-template">
  <span>
    <img src="/img/#: id #.png" alt="#: name #" />
    #: name #
  </span>
</script>
<script>
$("#autocomplete").kendoAutoComplete({
  dataSource: [
    { id: 1, name: "Apples" },
    { id: 2, name: "Oranges" }
  ],
  dataTextField: "name",
  template: kendo.template($("#template").html())
});
</script>

Example - specify template as a string

<input id="autocomplete" />
<script>
$("#autocomplete").kendoAutoComplete({
  dataSource: [
    { id: 1, name: "Apples" },
    { id: 2, name: "Oranges" }
  ],
  dataTextField: "name",
  template: '<span><img src="/img/#: id #.png" alt="#: name #" />#: name #</span>'
});
</script>
In this article