如果我更改任何文本或给出退格符,复选框将取消选中,并且Ckeditor中值将为0。我试过了,但我做不到。我该如何解决这个问题?
CKEDITOR.replace( 'editor1' ); <script src="https://cdn.ckeditor.com/4.16.2/standard/ckeditor.js"></script>
<input type="checkbox" id="description" value="1" checked>
<textarea name="editor1">Lorem ipsum dolor amet</textarea>
发布于 2021-09-23 09:59:41
您可以监听CKEDITOR.instances的event change
const checkbox = document.getElementById('description');
CKEDITOR.replace('editor1');
for (const i in CKEDITOR.instances) {
CKEDITOR.instances[i].on('change', function () {
checkbox.checked = false;
checkbox.value = 0;
});
}或您需要的实例
const checkbox = document.getElementById('description');
CKEDITOR.replace('editor1');
CKEDITOR.instances.editor1.on('change', function () {
checkbox.checked = false;
checkbox.value = 0;
});https://stackoverflow.com/questions/69297403
复制相似问题