gpt4 book ai didi

jquery - 加载 Bootstrap Wysiwyg 编辑器内容

转载 作者:行者123 更新时间:2023-12-01 00:18:26 26 4
gpt4 key购买 nike

找到这个Save and Load Bootstrap Wysiwyg editor content 。但加载并没有按照建议进行。

已创建 http://jsfiddle.net/vNPAJ/28/

jQuery

jQuery(document).ready(function ($) {            
$("#t1").wysihtml5();
$("#b1").click(function () {
$("#t2").val($("#t1").val());
});
$("#b2").click(function () {
$("#t1").val($("#t2").val());
});
});

HTML

<textarea style="width:570px" id="t1">Test <b>Data</b></textarea><br /><br />
<textarea id="t2"style="width:570px"></textarea><br /> <br />
<button class="btn-primary" id="b1" type="button">Get</button>
<button class="btn-primary" id="b2" type="button">Set</button>

获取工作正常。

单击设置按钮后,我想用第二个文本区域的源代码填充编辑器。

不知道该怎么做...

最佳答案

研究您的问题后。看来您需要使用 hack 来填充 wysihtml5() 中的值,因为它包含 iframe

尝试这样做,我在 #bt2 中添加了一行,将值设置为 #t1

jQuery(document).ready(function ($) {            
$("#t1").wysihtml5();
$("#b1").on('click',function () {
$("#t2").val($("#t1").val());
});
$("#b2").on('click',function () {

$("#t1").parent('body').find('iframe').contents().find('.wysihtml5-editor').html('I changed!');
});
});

关于jquery - 加载 Bootstrap Wysiwyg 编辑器内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20298764/

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