Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is the code, and you can't put button inside contents it must be outside of editor contents :</p> <pre><code>&lt;body&gt; &lt;script type="text/javascript"&gt; function replaceImage() { var editor = $find("&lt;%= reFormEditor.ClientID %&gt;"); var oDocument = editor.get_document() var img = oDocument.getElementById('imageInContents'); img.src = '/image2.png'; } &lt;/script&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:ScriptManager ID="mika" runat="server"&gt;&lt;/asp:ScriptManager&gt; &lt;telerik:RadEditor runat="server" ID="reFormEditor"&gt; &lt;Content&gt; &lt;img id="imageInContents" src="/image1.png" /&gt; &lt;/Content&gt; &lt;/telerik:RadEditor&gt; &lt;input type="button" onclick="replaceImage()" value="Replace Image" /&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>And here is an example with text change</p> <pre><code>&lt;body&gt; &lt;script type="text/javascript"&gt; function replaceSpanText() { var editor = $find("&lt;%= reFormEditor.ClientID %&gt;"); var oDocument = editor.get_document() var spn = oDocument.getElementById('span1'); spn.innerHTML = 'Text 2'; } &lt;/script&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:ScriptManager ID="mika" runat="server"&gt;&lt;/asp:ScriptManager&gt; &lt;telerik:RadEditor runat="server" ID="reFormEditor"&gt; &lt;Content&gt; &lt;span id="span1"&gt;Text 1&lt;/span&gt; &lt;/Content&gt; &lt;/telerik:RadEditor&gt; &lt;input type="button" onclick="replaceSpanText()" value="Replace text" /&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload