如何使用JavaScript获取Tinymce文本区域的内容 [英] How to get the content of a Tinymce textarea with JavaScript

查看:77
本文介绍了如何使用JavaScript获取Tinymce文本区域的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内容数组,然后我们如何在javascript中获取Tinymce textarea的内容

i have an array of content then how we get content of Tinymce textarea in javascript

推荐答案

让您说您的mce textarea实例是:

lets say your mce textarea instance is:

<textarea id="editor1" ....></textarea>

然后您将获得如下内容:

then you get the content as follows:

var content =  tinyMCE.getContent('editor1');

如果您的意思是在一个页面上有多个mce编辑器实例,并且想要获取内容,请尝试以下方法:

if you mean you have multiple instances of mce editor on one page and you want to get content then try this approach:

var inst, contents = new Object();
for (inst in tinyMCE.editors) {
    if (tinyMCE.editors[inst].getContent)
        contents[inst] = tinyMCE.editors[inst].getContent();
}

上面的代码将每个编辑器内容添加到数组中

the above code adds each editor content into an array

这篇关于如何使用JavaScript获取Tinymce文本区域的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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