如何使用jquery将HTML加载到TinyMCE textarea中 [英] How to load html using jquery into a TinyMCE textarea

查看:110
本文介绍了如何使用jquery将HTML加载到TinyMCE textarea中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用TinyMCE作为所见即所得的文本区域. 加载完该文本区域后,我想要这样做,单击编辑"按钮,将随AJAX jquery带来的一些html代码加载到该文本区域中.

I've a textarea that uses TinyMCE as a WYSIWYG. Once that this textarea is loaded I want that, clicking a button "Edit" some html code that I bring with AJAX jquery is loaded in that textarea.

我要插入此html代码<p>hello</p>

I want to insert this html code <p>hello</p>

原始文本区域来源

<textarea name="corpo" id="input_corpo">Text Here</textarea>

带HTML的JQUERY脚本.这样,它仅更新文本区域(在TinyMCE运行时隐藏)

JQUERY Script that brings the HTML. In this way it updates only the textarea (which is hidden while TinyMCE is in action)

$.get("hello.html", 
        function(content){ $("#input_corpo").text(content);});
     return false;});

下面的任何一种都不起作用.我试图更新生成TinyMCE的iframe的主体

Neither in this way below it works. I tryed to update the body of the iframe that generates TinyMCE

$.get("hello.html", 
    function(content){ $("body#tinymce").text(content);});
return false;});

我该怎么办?

推荐答案

您可以尝试使用

或更短:

$.get("hello.html", tinyMCE.activeEditor.setContent);

这篇关于如何使用jquery将HTML加载到TinyMCE textarea中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆