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

Change RadEditor ContentAreaCssFile on client side

Environment

Product RadEditor for ASP.NET AJAX

Description

See how to change the RadEditor ContentAreaCssFile on the client by updating the href attribute of the iframe content area CSS file

Solution

Here is the implementation:

   <script type="text/javascript">
        function OnClientLoad(editor) {
            setTimeout(function () {
                var head = editor.get_document().getElementsByTagName("HEAD")[0];
                $telerik.$(head).find("#RADEDITORSTYLESHEET0").attr("href", "EditorContentAreaNew.css");
            }, 200);
        }
    </script>
    <telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad" ContentAreaCssFile="EditorContentArea.css">
        <Content>
            <div class="myClass">sample content</div>
        </Content>
    </telerik:RadEditor>
In this article