New to Telerik UI for ASP.NET AJAX? Download free 30-day trial


Returns the HTML of the selection.   function getSelectionHtml()

The example below demonstrates how to get the selected HTML and wrap it inside a DIV element with applied formatting:

<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1">
        Here is sample content!    
<input type="button" value="Apply Formatting" onclick="SetFormatting()" />
<script type="text/javascript">
    function SetFormatting()
        var editor = $find("<%=RadEditor1.ClientID%>");//get a reference to RadEditor client object    
        var selection = editor.getSelectionHtml();
        editor.pasteHtml('<div style="color: red;font-weight: bold;font-style: italic;">' + selection + '</div>');
In this article