Documentation

editor.getSelection()

Returns a W3C-compatible Selection object form the editable area.

Syntax

editor.getSelection()

Return value

Type: object

A W3C-compatible Selection object form the editable area.

Example usage

var editor1 = new RichTextEditor("#div_editor1");
editor1.setHTMLCode("hello world");
editor1.selectDoc();
var sel=editor1.getSelection()
console.log(sel)
var rect=sel.getRangeAt(0).getBoundingClientRect();
alert("width : "+rect.width);