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

how to get editor object in java script

3 Answers 68 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Uma
Top achievements
Rank 1
Uma asked on 12 Jan 2012, 09:20 AM
Hi, i am new to rad editor.

i want to get the editor content in java script on button click.

So i am using the following code.

'  var editor = $find("<%#radEditor.ClientID%>"); //get a reference to RadEditor client object    

        var editorContent = editor.get_html();
      
'

i am using with master page.

so i try to get editor like document.getElementById('ct100_cpEditor_radEditor')
but i cant use the get_html() method with this id.
and document.getElementById('radeditor')-this return null.

how to get the editor object in java script?

Thanks,
Uma

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Jan 2012, 10:12 AM
Hello,

Try the following to access RadEditor on button click.
JS:
<script type="text/javascript">
 function OnClientClick()
  {
    var RadEditor1 = $find("<%= RadEditor1.ClientID %>");
  }
</script>

Thanks,
Princy.
0
Uma
Top achievements
Rank 1
answered on 12 Jan 2012, 10:24 AM
Thanks for your reply.

i try your code. it shows the following error.

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).


i write the script with in body of the page. how to get this?

Thanks,

Uma
0
Rumen
Telerik team
answered on 12 Jan 2012, 01:28 PM
Hi,

Could you please wrap the parts containing code blocks with RadCodeBlock control and see if the problem still occurs? If so, could you please provide a simple runnable project reproducing the problem so we can investigate it further?

Greetings,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Editor
Asked by
Uma
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Uma
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or