How can I get content data what I am write in CLEditor using jquery keyup?
2 Answers
Wouldn't it make more sense to use CLEditor's .change
event? From the documentation:
change - This event is triggered whenever the contents of the editor have changed. Since change detection is done using the keyup and mouseup events, this event occurs frequently as the user types.

- 339,989
- 67
- 413
- 406
-
Yes... but how to get the content data in the change event? – scippie Feb 19 '12 at 14:08
I'm using version 1.3.0 of the cleditor, the following code is unofficial, I might be bad code, because I'm oop noob AND for many other reasons, but until the next release it does the trick for me : here is what I did :
In file jquery.cleditor.js :
add a trickyMethod option : line 100 :
replace this
imagesPath: function() { return imagesPath(); },
by this :
imagesPath: function() { return imagesPath(); },
trickyMethod: function(){}
Make the trickyMethod be called on keyup event : line :878
replace this :
$doc.click(hidePopups)
.bind("keyup mouseup", function() {
refreshButtons(editor);
});
by this :
$doc.click(hidePopups)
.bind("keyup mouseup", function() {
refreshButtons(editor);
editor.options.trickyMethod(editor);
});
Now you can go in your application code and invoke the cleditor with the trickyMethod option :
$("#input").cleditor({
width: 600,
height: 600,
trickyMethod: function(){ alert("sdf"); }
});

- 11
- 1