Fab*_*abi 3 forms ajax wysihtml5
我只是在做一个小小的网络服务.因此,我正在使用AJAX调用并将我的数据附加到我网站上的表中.在这里,我可以读取和更新现有条目或编写新条目.一切正常.
我希望有可能使用wysihtml5编辑器更新已存在的内容.我已经在我的网站上集成了这个编辑器,我可以在新的条目上使用它.这也有效.
但现在存在现有数据的问题.说到更新数据的表单,我希望现有数据显示为值.在所有输入上一切正常,只是wysihtml5不起作用.
我已经知道有一个iframe,这就是为什么我不能设置textarea的值.我搜索了一个解决方案并找到了以下代码(最后一行):
var editor = new wysihtml5.Editor("textareaid", { // id of textarea element
toolbar: "wysihtml5-toolbar", // id of toolbar element
parserRules: wysihtml5ParserRules, // defined in parser rules set
});
editor.setValue('Here's the content', true);
Run Code Online (Sandbox Code Playgroud)
通常这应该工作,但没有内容出现,控制台告诉我:
错误:wysihtml5.Sandbox:尚未加载Sandbox iframe
我尝试使用超时功能,但没有任何作用.在互联网上搜索似乎没有其他人遇到这个问题.我希望你能帮帮我,会很棒!
有没有办法设定价值?
这段代码对我有用
$("#product_details").data("wysihtml5").editor.getValue();// to get the value
$("#product_details").data("wysihtml5").editor.setValue('new content')// to set the value
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7956 次 |
| 最近记录: |