gpt4 book ai didi

wysihtml5 - 如何停用 Bootstrap-wysihtml5 jquery 编辑器实例?

转载 作者:行者123 更新时间:2023-12-01 10:01:17 24 4
gpt4 key购买 nike

我正在使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com