Status | |||||
---|---|---|---|---|---|
|
...
|
...
|
Returns an array of HTML Elements based on Selection. If no Selection is specified, returns the HTML Element corresponding to the current Selection.
Parameters:
Name | Type | Attribute | Description |
---|---|---|---|
selectionObject | Object | { | [ Optional ] |
A selection object with an anchor position and a focus position. If this value is not present, it operates based on the current selection. |
Return:
Type | Description |
---|---|
HTML Element[] |
An array of HTML Elements corresponding to Selection. In the caret state, the HTML Element where the caret is located is returned as an array. |
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var elements = editor.getHTMLElements(); console.log(elements[0].innerHTML); |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var selection = editor.getSelection(); var elements = editor.getHTMLElements(selection); console.log(elements[0].innerHTML); |
...