Check this:
$('#redactor').redactor({
keyupCallback: function(e)
{
console.log(this.get());
}
});
Pregunta
am trying to attach keyUp callback for redactor after initiation, the textarea is initiated with the following
$("#id_article-content").redactor({
"lang": "en",
"toolbarFixed": true,
"direction": "ltr",
"minHeight": 400,
"buttons": ["formatting", "|", "bold", "italic", "|", "orderedlist", "|", "link", "|", "horizontalrule"]
});
Problem is I cannot attach to the above my callback and I must do it after its has been ran, am trying to use the below code
$('#id_article-content').keyupCallback = function (e) {
console.log('ddd');
};
but that not working, would appreciate any help or pointers I can get on this?
Many thanks,
Solución
Check this:
$('#redactor').redactor({
keyupCallback: function(e)
{
console.log(this.get());
}
});
Otros consejos
just a quick guess, after looking at the API I think the code should look like this (untested):
$('#id_article-content').redactor({
keyupCallback: function (e) {
console.log('ddd');
});
You have to add callbacks on the initial setup of your redactor. If you try to do it afterward, in a separate call, it doesn't work.
$('#redactor).redactor({
buttons: ['formatting', '|', 'bold', 'italic', 'underline', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'horizontalrule'],
plugins: ['fontcolor'],
pastePlainText: true,
wym: true,
iframe: false,
focus: true,
keyupCallback: function (e) {
console.log(this.get());
}
});