Home   Pricing

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:

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