Re: Get Selected Text

  •  04-03-2014, 9:23 AM

    Re: Get Selected Text

    Hi jeff330ci,

     

    Please try the way below.

     

    1. <%@ Page Language="c#" ValidateRequest="false" %>  
    2.   
    3. <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>  
    4.   
    5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    6. <html xmlns="http://www.w3.org/1999/xhtml">  
    7. <head>  
    8.   
    9. </head>  
    10. <body>  
    11.     <form id="Form1" method="post" runat="server">  
    12.         <RTE:Editor ID="Editor1" runat="server" />  
    13.         <input type="button" value="get select content" onclick="getSelectContent()" />  
    14.     </form>  
    15. </body>  
    16. </html>  
    17. <script type="text/javascript">  
    18.     function getSelectContent() {  
    19.         var editor1 = document.getElementById('<%= Editor1.ClientID%>').editor;  
    20.         //get select html  
    21.         var selhtml = editor1.ExtractRangeHTML();  
    22.         //get plain text  
    23.         var plainText = jsml.html_decode(selhtml);  
    24.         alert(plainText);  
    25.     }  
    26.   
    27. </script>  
     

    Regards,

     

    Ken 

View Complete Thread