【问题标题】:TinyMCE - An invalid form control with name='content' is not focusableTinyMCE - name='content' 的无效表单控件不可聚焦
【发布时间】:2018-07-28 00:51:40
【问题描述】:

我使用 TinyMCE 4,这是我的代码:

<script type="text/javascript" src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
       tinymce.init({
         selector: 'textarea[name=content]',
         plugins: 'image code',
         toolbar: 'undo redo | link image | code',
         image_title: true, 
         automatic_uploads: true,
         file_picker_types: 'image', 
         file_picker_callback: function(cb, value, meta) {
           var input = document.createElement('input');
           input.setAttribute('type', 'file');
           input.setAttribute('accept', 'image/*');
           input.onchange = function() {
             var file = this.files[0];
             var reader = new FileReader();
             reader.onload = function () {
             var id = 'blobid' + (new Date()).getTime();
             var blobCache =  tinymce.activeEditor.editorUpload.blobCache;
             var base64 = reader.result.split(',')[1];
             var blobInfo = blobCache.create(id, file, base64);
             blobCache.add(blobInfo);
             cb(blobInfo.blobUri(), { title: file.name });
           };
           reader.readAsDataURL(file);
         };
         input.click();
       }
     });  
</script>

我有一个问题。当我单击“提交”按钮时,表单未发送,但在 Web 浏览器控制台中出现错误:“名称 ='content' 的无效表单控件不可聚焦。”

请你帮帮我,我怎样才能简单地解决这个问题?提前感谢所有建议。

【问题讨论】:

  • 请添加您的html
  • 拜托,你能描述一下你的意思吗?
  • 你在哪里用 [name=content] 设置你的 texarea?
  • 在同一个文件中,tinymce 编辑器也是如此。

标签: javascript tinymce tinymce-4


【解决方案1】:

问题来自 tinymce 隐藏文本区域。删除所需的属性,它应该是固定的!

【讨论】:

猜你喜欢
  • 2021-05-24
  • 2020-02-12
  • 1970-01-01
  • 2017-07-07
  • 2020-08-16
  • 2015-08-19
  • 2013-05-31
  • 1970-01-01
  • 2016-11-20
相关资源
最近更新 更多