Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';t使用媒体编辑器附加元素(元素)_Javascript_Medium Editor - Fatal编程技术网

Javascript Can';t使用媒体编辑器附加元素(元素)

Javascript Can';t使用媒体编辑器附加元素(元素),javascript,medium-editor,Javascript,Medium Editor,我想使用addElements()函数向我的页面添加一些html。我真的不知道如何使用它。现在它只是添加了一个可编辑的空行 我的代码: var editor = new MediumEditor('.changeable'); elements = "<section id='"+new_id+"' class='changeable'><h1 class='title_section'>"+newTitle+"</h1><p>This is a

我想使用addElements()函数向我的页面添加一些html。我真的不知道如何使用它。现在它只是添加了一个可编辑的空行

我的代码:

var editor = new MediumEditor('.changeable');
elements = "<section id='"+new_id+"' class='changeable'><h1 class='title_section'>"+newTitle+"</h1><p>This is a new paragraph.</p></section>";
editor.addElements(".container_content",elements);
var编辑器=新的MediumEditor('.change');
elements=“”+newTitle+”这是一个新段落。

”; 编辑者。附录(“.container\u content”,元素);
我的选择器是具有“container\u content”类的元素。我想在其中添加var“elements”的html

谢谢。

好的,我发现问题了。 必须先创建要添加的元素。然后调用.addElements(您的元素)