how to get editor object in java script

4 posts, 0 answers
  1. Uma
    Uma avatar
    18 posts
    Member since:
    Jan 2012

    Posted 12 Jan 2012 Link to this post

    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

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2012 Link to this post

    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.
  3. Uma
    Uma avatar
    18 posts
    Member since:
    Jan 2012

    Posted 12 Jan 2012 Link to this post

    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
  4. Rumen
    Admin
    Rumen avatar
    14459 posts

    Posted 12 Jan 2012 Link to this post

    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
Back to Top