New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Selection Object

You can get a reference to the current selection in RadEditor by using its getSelection method.

The Selection object exposes the following public methods and properties to control its behavior:

Selection Client-Side Methods

NameParametersReturn TypeDescription
collapseBooleanCollapses a selection to the starting or ending position.The method takes the following arguments: toStart - The direction in which to collapse the selection. If true the selection will collapse from end to start.
getBrowserSelectionObjectReturns the browser's Selection object
getHtmlStringReturns the selection's content as HTML
getParentElementElementReturns a reference to the selection's parent DOM element
getRangeObjectReturns a reference to a range object
getTextStringReturns the selected content as plain text
isControlBooleanSpecifies whether the current selection is a control or not.
moveToElementTextElementRecreates the selection range.The method takes the following arguments: element - DOM element to be selected.
pasteHtmlString, BooleanPastes string at current selectionThe method takes the following arguments: htmlString - String to be pasted bSelContent - Specifies whether to select pasted content after execution
selectElementElementAdds an element to current selectionThe method takes the following arguments: oElement - DOM element to be added
selectRangeObjectSelects the previously stored rangeThe method takes the following arguments: **range
Not finding the help you need?
Contact Support