← 全部文档

editor.surroundByTagName(tagname)

获取选区的内容并放入一个元素中,然后插入这个新元素。

语法

editor.surroundByTagName(tagname)

参数

类型:String

必填。要插入的元素的标签名。

返回值

类型:HTMLElement

刚插入的 HTML 元素。

用法示例

var editor1 = new RichTextEditor("#div_editor1");      
editor1.setHTMLCode("hello world");      
editor1.selectDoc();      
editor1.surroundByTagName("blockquote");