如何使用内联 TinyMCE 编辑器在没有输入的情况下提交表单内容?

How do you submit form content without inputs with inline TinyMCE editor?

以下是他们在文档中告诉您的方法。

  <form method="post" action="process.php">
    <div class="wysiwyg">Click here to edit the first section of content!</div>
    <input type="submit">
  </form>

然后在文档的头部:

tinymce.init({ selector: '.wysiwyg',
        inline: true,
etc...

但我需要为 div 的内容指定一个名称,以便我的 php 处理页面可以获取该内容。我该怎么做?

我试过改成get方式,好像是用"mce_0"作为名字。

尝试手动完成,例如,将 id 添加到您的 wysiwyg

<div id="my-wysiwyg" class="wysiwyg">Click here to edit the content!</div>

然后获取值

var txt = $('#my-wysiwyg').html();

然后手动制作一个post

$.post('my.php', {wysiwyg: txt}, function onSuccess(response){
  console.log(response);
});

然后,在您的 php 中,您将获得 name 所见即所得。这只是一个说明性示例,说明如何根据您的情况进行调整。

Check this out. 希望对你有帮助