How do i get text/html of the Editor while pressing the button?
I use alert(window.frames["iFramID"].getText()); but it doesn't seem to work.
What am i doing wrong?
2 Answers, 1 is accepted
0
Rumen
Telerik team
answered on 09 Mar 2009, 08:59 AM
Hi Yuri,
Here is an example how to call a function located in the iframe from the parent page:
Parent.aspx
<input type="button" value="Get Editor Content" onclick="CallInlineFunction();return false;" />
<script type="text/javascript">
function CallInlineFunction()
{ //execute the GetRadEditorContent function placed in the page loaded in the IFRAME document.getElementById('iFramID').contentWindow.GetRadEditorContent();
}
</script>
<iframe src="Default.aspx" id="iFramID" style="width: 779px; height: 535px"></iframe>
Child.aspx
<script type="text/javascript">
function GetRadEditorContent()
{
var editor = $find("<%= RadEditor1.ClientID %>"); //get a reference to RadEditor
alert(editor.get_html(true)); //get the editor's content
}
</script>
<telerik:RadEditor id="RadEditor1"
Runat="server">
<Content>
</Content>
</telerik:RadEditor>
The reason why it wasn't working for me because my iframe parents and child were in different domains. If i had my script debug on i would have known this earlier.