我正在为一个我正在工作的网站使用CLEditor。我正在尝试用jQuery将动态文本添加到文本区。通常我会使用类似这样的东西:
$('#myText').val('Here some dynamic text');但这在CLEditor上是行不通的。当禁用CLEditor时,它工作得很好,但再次启用它时,文本就会消失。我试图在网站上寻找解决方案,但我找不到任何解决方案。最近有没有人有同样的问题?
提前谢谢。
发布于 2011-02-24 18:08:51
$("#input").cleditor({width:500, height:250,updateTextArea:function (){....}})发布于 2011-09-23 07:30:27
CLEditor在调用textarea的iFrame方法时更新模糊内容:
//make CLEditor
$(document).ready(function() {
$('#text').cleditor();
});
//set value
$('#text').val('new text data').blur();发布于 2012-01-12 15:02:57
我也遇到了同样的问题,最终在评论中找到了一些有用的东西,所以这就是我所拥有的;希望这会对以后的人有用。
// initializing the cleditor on document ready
var $editor = $('#description').cleditor()然后,当我获得一些html并需要动态地将其插入到cleditor中时,下面是我使用的方法:
// update the text of the textarea
// just some simple html is used for testing purposes so you can see this working
$('#description').val('<strong>testing</strong>');
// update cleditor with the latest html contents
$editor.updateFrame();https://stackoverflow.com/questions/5093076
复制相似问题