← すべてのドキュメント

editor.surroundElement(element)

editor.document を使って要素を作成し、選択範囲のコンテンツをその要素の中に入れてから、その新しい要素を挿入します。

構文

editor.surroundElement(element)

パラメーター

型:HTMLElement

必須。挿入する新しい要素。

使用例

var editor1 = new RichTextEditor("#div_editor1");      
editor1.setHTMLCode("hello world");      
editor1.selectDoc();        
var element=editor1.document.createElement("BLOCKQUOTE");      
editor1.surroundElement(element);