问题
How can I attach "keyup" event to CKEdtior (I am using the jQuery adapter)
This is the code I am currently using:
$('#ckeditor textarea').ckeditor(function(editorInstance) {
/* attaching "keyup" doesnt seem work so I have to stick with "key" */
$('#ckeditor textarea').ckeditorGet().on('key', function(e) {
/* do stuff ... */
});
}, {
skin : 'office2003'
});
The whole idea is to get the ckeditor content every time the content is changed. Hope someone can help here.
Thanks
回答1:
Ok, this seems to work for me.
$('#ckeditor textarea').ckeditor(function() {
var editor = $('#ckeditor textarea').ckeditorGet();
editor.on('contentDom', function() {
editor.document.on('keyup', function(event) {
/* do stuff */
});
}, {
skin : 'office2003'
});
来源:https://stackoverflow.com/questions/11711364/ckeditor-add-keyup-event