kendo-uikendo-editor

Kendo UI (Editor) - On Click Link, Insert HTML


I am using Kendo UI - Editor.

If I click on Show Message link, "Click Success!" message should appear inside Editor

I want to show Custom Text inside Editor on Clicking on "Show Message" link...

Pleae Help !!!

$(document).ready(function(){
  $(".importeditor").kendoEditor({
    tools: [
      "bold",
      {
        name: "custom",
        myText: "Show Message",
        template: $("#toolTemplate").html()
      },
    ]
  });
});

jQuery('#ClickMe').on('click', function () {
  jQuery(".importeditor").data('kendoEditor').val('Click Success!');
});
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.3.1111/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2015.3.1111/styles/kendo.material.min.css" />

<script src="//kendo.cdn.telerik.com/2015.3.1111/js/jquery.min.js"></script>
<script src="//kendo.cdn.telerik.com/2015.3.1111/js/kendo.all.min.js"></script>
<script src="//kendo.cdn.telerik.com/2015.3.1111/js/kendo.timezones.min.js"></script>

<div class="textedit1">
  <textarea rows="10" cols="45" name="textarea" class="txtarea importeditor"></textarea>
</div>

<script id="toolTemplate" type="text/x-kendo-template">
    <a href="\#" id="ClickMe">#= myText #</a>
</script>


Solution

  • Use the value method IE

      jQuery(".importeditor").data('kendoEditor').value('Click Success!');
    

    Also you might want to fix your href in the a tag

    <a href="\#" id="ClickMe">#= myText #</a>