我使用Bootstrap-Wysihtml5jQuery插件(https://github.com/jhollingworth/bootstrap-wysihtml5/)将文本转换为所见即所得。我希望能够通过点击2个按钮来激活和停用编辑器,到目前为止我可以显示编辑器,请你告诉我如何停用编辑器,只留下文本区及其值。我的代码如下:
HTML
<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
<input type="button" id="button1" value="Show Editor">
<input type="button" id="button2" value="Hide Editor">脚本
$("#button1").click(function(){
$('textarea').wysihtml5();
});
$("#button2").click(function(){
// this is where i'm stuck
});谢谢
发布于 2013-09-09 23:04:28
我尝试禁用/隐藏工具栏和编辑器时也遇到了同样的问题,并幸运地使用了以下命令(禁用编辑器)。我使用的是版本wysihtml5-0.3.0_rc2.js)
$('#editorId').data('wysihtml5').editor.composer.disable();
$('#editorId').data('wysihtml5').editor.composer.enable();或者(隐藏编辑器)
$('#editorId').data('wysihtml5').editor.composer.hide();
$('#editorId').data('wysihtml5').editor.composer.show();要对工具栏执行相同的操作,请执行以下操作以隐藏/显示(找不到禁用工具栏的wat ):
$('#editorId').data('wysihtml5').editor.toolbar.hide();
$('#editorId').data('wysihtml5').editor.toolbar.show();发布于 2015-02-25 20:40:24
几行自定义JS代码。我想他们能帮到你。
var content = $('#content');
var contentPar = content.parent()
contentPar.find('.wysihtml5-toolbar').remove()
contentPar.find('iframe').remove()
contentPar.find('input[name*="wysihtml5"]').remove()
content.show()https://stackoverflow.com/questions/15712214
复制相似问题