I'm using the Telerik Kendo UI editor for a field that can be posted to the server.
@( Html.Kendo().EditorFor(model => model.TickerContent)
.Name("TickerContent")
.Encode(true)
.HtmlAttributes(new { style = "width:100%;height:440px" }))
On the same page as the form I have a list of items that I want to be able to edit, so I need to set the value of the editor. The demo code uses the following code to get and set the value of the editor:
<script>
$(document).ready(function () {
var editor = $("#Editor").data("kendoEditor");
var setValue = function () {
editor.value($("#value").val());
};
$("#get").click(function () {
alert(editor.value());
});
$("#set").click(setValue);
});
</script>
The value of variable editor is always undefined. My question is how can I get and set the editor value?
I tried var editor = $("#TickerContent").data("kendoEditor"); but the editor is still undefined.
Same issue here, here is what I did:
For the html
For the JS
then the "editor" is not undefined