Kendo MVC Editor button with action

1 Answer 91 Views
Chris Womack
Top achievements
Rank 1
Chris Womack asked on 28 Feb 2022, 08:19 PM

I need to be able to add a form button in the content using the editor. Using the "view html" tool, I am able to create a button. However, I need this button to have an "onclick" property. This was possible in pervious rad editor. Is this a possibility in the current editor? 

Currently, that "onclick" property value gets stripped out when pressing "update". 

<inupt type="button" onclick="myfunction()" value="here" /> 

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 03 Mar 2022, 02:33 PM

Hello Chris,

In it's classic mode the Editor renders the content in an iframe. To attach a click handler to an element in the iframe you can follow the approach in this SO thread, for example. That said, you can achieve the desired result the following way:

    <div id="example" class="demo-section k-content wide editor">
                  .HtmlAttributes(new { style = "width: 100%; height:840px" })
                  .StyleSheets(css => css
                  .Tools(tools => tools
                          <button type="button" id="btn" value="Button clicked" >Button</button> 
            var editor = $("#editor").getKendoEditor();



Here is a sample REPL.

Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Asked by
Chris Womack
Top achievements
Rank 1
Answers by
Telerik team
Share this question