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

Open Link in a New Window When Clicked

The code below demonstrates how to iterate RadEditor document links when the editor is loaded. The code sets the link target attribute to so that the link is opened in a new window when clicked. You can use this approach to modify the attributes and events of all HTML elements in the editor content area. This example opens the editor in Preview EditorMode so that clicking the links will have the expected behavior.

<script type="text/javascript">
    function OnClientLoad(editor)
        var links = editor.get_document().getElementsByTagName("A");
        for (var i = 0; i < links.length; i++)
            var link = links[i];
            link.setAttribute("target", "#");
<telerik:RadEditor RenderMode="Lightweight" ID="RadEditor1" runat="server" Skin="Default" OnClientLoad="OnClientLoad"
        Sample Content        
        <a href=";></a>
        <a href=""></a>
        <a href="">some.pdf</a>
In this article