我使用 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’的无效表单控件不可聚焦。”
请你帮我,我怎样才能简单地解决这个问题?提前感谢所有建议。
最佳答案
问题来自 tinymce 隐藏文本区域。删除必需的属性,它应该被修复!
关于javascript - TinyMCE - 名称为 ='content' 的无效表单控件不可聚焦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48838175/