我使用javascript的插件拥有一个名为Trumbowyg的HTML编辑器(WYSIWYG)。使用此插件实例化创建元素时没有出现错误,但由于某些原因,带有按钮/选项的面板没有出现。
我的守则:
var editorHtmlElement = document.createElement('textarea');
editorHtmlElement.className = "col-md-6";
editorHtmlElement.setAttribute('placeholder', 'placeholder...');
var OptionsTrumbowyg = {};
OptionsTrumbowyg.btns = [
['undo', 'redo'],
['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
['formatting'],
['strong', 'em', 'del'],
['link'],
['insertImage'],
['unorderedList', 'orderedList'],
['horizontalRule'],
['removeformat'],
];
OptionsTrumbowyg.autogrow = true;
var editorHtmljQuery = $(editorHtmlElement);
editorHtmljQuery.trumbowyg(OptionsTrumbowyg);在此之后,我将editorHtmlElement附加到div或其他地方。
预期:

我得到了什么

如您所见,没有显示带有按钮的面板,即使我尝试在默认情况下没有自定义选项.有人知道为什么吗?
(没有出现错误)
发布于 2017-12-27 17:39:42
我设法通过在CSS的附加和包含之后添加Trumbowyg,并更改
var editorHtmlElement = document.createElement('textarea');
至
var editorHtmlElement = document.createElement('div');
刚搬了
editorHtmljQuery.trumbowyg(OptionsTrumbowyg);
当加载页面时,对于所有脚本的结束,它都运行良好。
https://stackoverflow.com/questions/47994736
复制相似问题