Div extends Element

The API model used to edit the DIV.

Methods

append(html)

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)

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.

var div = editor.getAPIModelById('id');
div.remove();

replace(html)

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)

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)

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'])

Sets the height of the DIV.

var div = editor.getAPIModelById('id');
div.setHeight(200);
div.setHeight(200, 'px');

setWidth(value[, unit = 'px'])

Sets the width of the DIV.

var div = editor.getAPIModelById('id');
div.setWidth(400);
div.setWidth(100, '%');