验证多个TinyMCE编辑器 [英] validating multiple TinyMCE Editor

查看:92
本文介绍了验证多个TinyMCE编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个TinyMCE编辑器的表单.有些编辑器是高级的,有些是简单的编辑器.我已使用 jquery验证插件在客户端进行验证.我一直在通过添加以下代码来验证单个TinyMCE编辑器.

I have a form with multiple TinyMCE editors. Some of the editors are advance and some are simple editors. I have used jquery validation plugin for validation in client-side. I have been validating single TinyMCE editor by adding following code.

$('#submit').click(function() {

    var content = tinyMCE.activeEditor.getContent(); // get the content

    $('#description').val(content); // put it in the textarea

});

但是现在我应该验证所有编辑器,任何想法吗?

But now i am supposed to validate all editors, any idea??

推荐答案

尝试

$('#submit').click(function() {

  for (i=0; i < tinymce.editors.length; i++){
    var content = tinymce.editors[i].getContent(); // get the content

    $('#description').val(content); // put it in the textarea
  }
});

或更简单

$('#submit').click(function() {
     tinymce.triggerSave();
});

这篇关于验证多个TinyMCE编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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