getting the "Rad Editor" Content Value throgh Java Script

4 posts, 0 answers
  1. Darryl Henderson
    Darryl Henderson avatar
    8 posts
    Member since:
    Mar 2008

    Posted 29 Apr 2009 Link to this post

    how to get the "Rad Editor" Control Content  value at the ClientSide (java Script), without postback.

    Thanks & Regards
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Apr 2009 Link to this post

    Hi Srinivas,

    You can use either get_text() or get_html() for getting the content of RadEditor in client side. The get_html() returns the editor content as HTML and get_text() returns the editor content as plain text.

    <telerik:radeditor id="RadEditor1" runat="server" ToolbarMode="ShowOnFocus"         
    <input id="Button1" type="button" value="Get Content" onclick="Content();" /> 

    <script type="text/javascript">    
    function Content()    
        var editor = $find("<%=RadEditor1.ClientID%>");    
        var message = editor.get_text(); //get the editor content as plain text    
        alert(message); //alert the plain text content    

    Checkout the following link for important RadEditor client side methods.
    Getting familiar with Client-Side API

  3. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 30 Apr 2009 Link to this post

    Hi Darryl Henderson,

    For this purpose you could use the get_text() or get_html() methods (get_html(true) will return the HTML content that is already modified by the editor's client filters.

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    <telerik:RadEditor ID="RadEditor1" runat="server"
    <button onclick="getContent('html'); return false;">get HTML content</button><br /> 
    <button onclick="getContent('text'); return false;">get text content</button> 
    <script type="text/javascript"
    function getContent(arg) 
        var editor = $find("<%= RadEditor1.ClientID %>");  
        if(arg == "html") 
            alert("RadEditor HTML content: \n \n" + editor.get_html());  
            alert("RadEditor Text content: \n \n" + editor.get_text());  

    Note that for the native ASP.NET AJAX $find() method to work, you must have an asp:scriptmanager or telerik:radscriptmanager control on your page.
    More information on RadEditor's client-side API is available here.

    All the best,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. vishwa
    vishwa avatar
    1 posts
    Member since:
    Dec 2008

    Posted 19 Jun 2012 Link to this post

    Hi Princy,

    Its worked for me !!!

Back to Top