RELEASE 2.11.0 OR ABOVE
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:
Type | Description |
---|---|
HTML Element | HTML Element corresponding to Position |
Example:
If position is not specified
var element = editor.getHTMLElement(); console.log(element.innerHTML);
If position is specified using Selection
var selection = editor.getSelection(); var startElement = editor.getHTMLElement(selection.start); console.log(startElement.innerHTML); var endElement = editor.getHTMLElement(selection.end); console.log(endElement.innerHTML);