Div extends Element
The API model used to edit the DIV.
Methods
append(html)
- html <String> 추가할 HTML String.
The HTML String passed as an argument is added as a child at the back of the Element.
var div = editor.getAPIModelById('id'); div.append('<span>TEXT</span>');
prepend(html)
- html <String> HTML String to append.
The HTML String passed as an argument is added as a child to the front of the Element.
var div = editor.getAPIModelById('id'); div.prepend('<span>TEXT</span>');
remove()
Removes the Element itself.
IF ALL ELEMENTS ARE REMOVED, ERRORS MAY OCCUR IN SUBSEQUENT OPERATIONS.
var div = editor.getAPIModelById('id'); div.remove();
replace(html)
- html <String> The HTML String to replace.
Replaces the element itself with the HTML String passed as an argument.
var div = editor.getAPIModelById('id'); div.replace('<div><p><span>Div replaced</span></p></div>');
setHTML(html)
- html <String> HTML string to set inside DIV
Set the HTML string value passed as an argument to the internal HTML of the DIV.
var div = editor.getAPIModelById('id'); div.setHTML('<p><span>Add HTML. All previously entered information will be erased.</span></p>');
setText(text)
- text <String> Text string to set inside DIV
Set the text string value passed as an argument to the internal Text of the DIV.
var div = editor.getAPIModelById('id'); div.setText('Sample Text.');
setHeight(value[, unit = 'px'])
- value<Number> Height
- unit <String> Unit of height ('px', '%'). default 'px'.
Sets the height of the DIV.
var div = editor.getAPIModelById('id'); div.setHeight(200); div.setHeight(200, 'px');
setWidth(value[, unit = 'px'])
- value<Number> Width
- unit <String> Unit of width ('px', '%'). default 'px'.
Sets the width of the DIV.
var div = editor.getAPIModelById('id'); div.setWidth(400); div.setWidth(100, '%');