Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

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()

Element 자신을 제거합니다.

모든 ELEMENT를 제거할 경우 이후의 작업에서 오류가 발생할 수 있습니다.

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

replace(html)

  • html <String> 교체할 HTML String.

Element 자신을 인자로 넘겨받은 HTML String으로 교체합니다.

var div = editor.getAPIModelById('id');
div.replace('<div><p><span>Div replaced</span></p></div>');

setHTML(html)

  • html <String> DIV 내부에 설정할 HTML 문자열

인자로 넘겨받은 HTML 문자열값을 DIV의 내부 HTML로 설정합니다.

var div = editor.getAPIModelById('id');
div.setHTML('<p><span>HTML를 추가합니다. 기존에 입력된 내용은 모두 지워집니다.</span></p>');

setText(text)

  • text <String> DIV 내부에 설정할 Text 문자열

인자로 넘겨받은 Text 문자열값을 DIV의 내부 Text로 설정합니다.

var div = editor.getAPIModelById('id');
div.setText('텍스트입니다.');

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

  • value<Number> 높이값
  • unit <String> 높이값의 단위 ('px', '%'). 기본값 'px'.

DIV의 높이를 설정합니다.

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

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

  • value<Number> 너비값
  • unit <String> 너비값의 단위 ('px', '%'). 기본값 'px'.

DIV의 너비를 설정합니다.

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