Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeEmacs
var div = editor.getAPIModelById('id');
div.prepend('<span>TEXT</span>');

remove()

Removes the Element 자신을 제거합니다itself.

Status
subtletrue
colourRed
title모든 Element를 제거할 경우 이후의 작업에서 오류가 발생할 수 있습니다If all elements are removed, errors may occur in subsequent operations.

Code Block
languagejs
themeEmacs
var div = editor.getAPIModelById('id');
div.remove();

replace(html)

  • html <String> 교체할 <String> The HTML String to replace.

Element 자신을 인자로 넘겨받은 HTML String으로 교체합니다Replaces the element itself with the HTML String passed as an argument.

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

setHTML(html)

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

...

  • <String> HTML string to set inside DIV

Set the HTML string value passed as an argument to the internal HTML of the DIV.

Code Block
languagejs
themeEmacs
var div = editor.getAPIModelById('id');
div.setHTML('<p><span>HTML를<p><span>Add 추가합니다HTML. 기존에 입력된 내용은 모두 지워집니다All previously entered information will be erased.</span></p>');

setText(text)

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

...

  • <String> Text string to set inside DIV

Set the text string value passed as an argument to the internal Text of the DIV.

Code Block
languagejs
themeEmacs
var div = editor.getAPIModelById('id');
div.setText('텍스트입니다Sample Text.');

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

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

DIV의 높이를 설정합니다Sets the height of the DIV.

Code Block
languagejs
themeEmacs
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'.

DIV의 너비를 설정합니다Sets the width of the DIV.

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

...