Returns an HTML Element based on Position. If Position is not specified, returns the HTML Element at the current caret position.


Parameters:

Name

Type

Attribute

Description

position

Position
[ Optional ] Position information in Selection. If this value is not specified, it is treated as the current caret position information.

Return:

TypeDescription
HTML ElementHTML Element corresponding to Position



Example:

var element = editor.getHTMLElement();
console.log(element.innerHTML);


var selection = editor.getSelection();
var startElement = editor.getHTMLElement(selection.start);
console.log(startElement.innerHTML);
var endElement = editor.getHTMLElement(selection.end);
console.log(endElement.innerHTML);