value
Gets or sets the value of the widget.
Important: This method does not trigger change event. This can affect MVVM value binding. The model bound to the widget will not be updated. You can overcome this behavior trigerring the
change
event manually using trigger("change") method.
<input id="autocomplete" />
<script>
$("#autocomplete").kendoAutoComplete();
var autocomplete = $("#autocomplete").data("kendoAutoComplete");
autocomplete.value("new value");
autocomplete.trigger("change");
</script>
Parameters
value String
The value to set.
Returns
String
the value of the widget.
Example - set and get the value of the widget
<input id="autocomplete" />
<script>
$("#autocomplete").kendoAutoComplete({
dataSource: [ "Apples", "Oranges" ]
});
var autocomplete = $("#autocomplete").data("kendoAutoComplete");
autocomplete.value("Apples");
var value = autocomplete.value();
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(value); // Displays "Apples"
</script>