I have plenty of textareas which act as a CKEDITOR 4
.
(我有很多文本区域可以充当CKEDITOR 4
。)
I'm trying to perform the AJAX request on each textarea by blur event.(我正在尝试通过模糊事件在每个文本区域上执行AJAX请求。)
I know how to do the blur
event.(我知道如何进行blur
事件。)
but the problem is how can I get the ckeditor
instance (textarea id) to get the data.(但是问题是我如何获取ckeditor
实例(textarea id)来获取数据。)
I found this question in SO and I tried but it doesn't help me.(我在SO中找到了这个问题,但我尝试了一下,但没有帮助。)
also I tried like below method but no luck This is how I'm making all the textareas into ckeditor(我也尝试了下面的方法,但是没有运气,这就是我将所有文本区域制作成ckeditor的方式)
$("textarea").each(function(){
CKEDITOR.inline( this,{toolbar:[{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat','Undo' ] },{ name: 'paragraph', groups: [ 'list' ], items: [ 'NumberedList', 'BulletedList' ] }]})
})
This below portion works well for particular id
(以下部分适用于特定ID)
CKEDITOR.instances.releaset44.on('blur', function() {
alert("save fun")
});
above codes are inside the body onload
function.
(以上代码位于body onload
函数内部。)
below code is in outside of the onload
func.(下面的代码在onload
函数的外部。)
please correct me if I'm wrong(如果我错了请纠正我)
var editors = CKEDITOR.instances;
for (var x in editors) {
if (editors[x]) {
var thisName = editors[x].name;
alert(thisName)
if (editors[thisName]) {
editors[thisName].on('blur', function (e) {
var data = e.editor.getData();
alert(data)
});
}
}
}
ask by Aroon translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…