This is a migrated thread and some comments may be shown as answers.

[Solved] Inserting Text at RadEditor's Cursor Position

1 Answer 135 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Lawrence
Top achievements
Rank 1
Lawrence asked on 12 Feb 2008, 05:50 AM
I tried the code:
function pasteTextInEditor(text)
{
    var editor = $find("<%=RadEditor1.ClientID%>");
    
editor.pasteHtml(text);
}

It seems that $Find and .PasteHtml doesn't work. 
Anybody know the solution for this?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 12 Feb 2008, 06:47 AM
Hi Lawrence,

I tried the provided code and it worked as expected.

Here is my code

<telerik:radeditor runat="server" ID="RadEditor1"></telerik:radeditor>
<input type="button" onclick="pasteTextInEditor('sample content')" value="set content" />
<script type="text/javascript">
function pasteTextInEditor(text)
{
    var editor = $find("<%=RadEditor1.ClientID%>");
    editor.pasteHtml(text);
}
</script>


For your convenience I have attached a sample runnable project that works fine.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or