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

Attaching blur event handler to RadEditor ContentArea

Description

How to attach the blur event listener to the RadEditor's ContentArea

Solution

Depending on the value set for the ContentAreaMode property, there are two different approaches

ContentAreaMode="Iframe"

    <script type="text/javascript">
        function InlineEditor_OnClientLoad(editor, args) {
            var element = editor.get_contentArea();
            $telerik.addExternalHandler(element, "blur", function (e) {
                alert("RadEditor loosed focus");
            });
        }
    </script>

    <telerik:RadEditor   
        id="editText" 
        Runat="server"
        ContentAreaMode="Iframe"
        OnClientLoad="InlineEditor_OnClientLoad"           
        >            
    </telerik:RadEditor>

ContentAreaMode="Div"

<script type="text/javascript">
    function InlineEditor_OnClientLoad(editor, args) {
        editor.attachEventHandler("blur", function (e) {
            alert("Blur fired");
        });
    }
</script>

<telerik:RadEditor   
    id="editText" 
    Runat="server"
    ContentAreaMode="Div"
    OnClientLoad="InlineEditor_OnClientLoad"          
    >            
</telerik:RadEditor>

See Also

In this article