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


Returns a reference to the currently selected HTML element in the RadEditor for ASP.NET AJAX content area.

The editor.getSelectedElement() method is useful in scenarios when the selected element in the content area should be examined and modified. The code fragment below is taken from the Custom Dialogs live example and demonstrates how to check whether the selected element is a LINK / ANCHOR tag and sets is as an argument for the showExternalDialog function:

<script type="text/javascript">    
    Telerik.Web.UI.Editor.CommandList["InsertSpecialLink"] = function(commandName, editor, args)    
        var elem = editor.getSelectedElement(); //returns the selected element.                     
        if (elem.tagName == "A") //if the selected element is link / anchor       
            editor.selectElement(elem); //selects the element            
            argument = elem;        

In this article