我正在使用 Bootstrap-wysihtml5 jquery 插件 ( 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
});
谢谢
最佳答案
几行自定义 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()
关于wysihtml5 - 如何停用 Bootstrap-wysihtml5 jquery 编辑器实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15712214/