假设您在代码之后包含了 jQuery 适配器,应该将其设为只读。如果尚未包含,您可以从示例中获取 jQuery 适配器。
<div class="wrapper">
<form id="myfrm" name="myfrm" class="myfrm" action="" method="post">
<textarea id="myeditor" name="myeditor"></textarea>
<input type="submit" id="submit" name="submit" value="Submit" />
</form>
</div>
和js
$(document).ready(function(e) {
var myeditor = $('#myeditor');
myeditor.ckeditor();
myeditor.ckeditorGet().config.resize_enabled = false;
myeditor.ckeditorGet().config.height = 200;
myeditor.ckeditorGet().config.readOnly = true;
});
要根据您对选择框的选择启用或禁用 ckeditor,您必须像这样进行更改事件
$(document).ready(function(){
//put ckeditor initialization (the above) here.
$('#myselect').change(function(){
var x = $(this);
if(x.val()=='enable'){
myeditor.removeAttr('disabled');
}else if(x.val()=='disable'){
myeditor.attr('disabled','disabled');
}
myeditor.ckeditorGet().destroy();
myeditor.ckeditor();
});
});
我们上面所做的是将原始元素设置为具有属性disabled="disabled"
并在销毁当前实例后重新加载 ckeditor。检查 JSFiddle 示例 2。
JSFiddle 示例
JSFiddle 示例 2 反映 OP 的查询