elliottbenzle
asked on
using onChange or OnKeyDown with CKEditor
I'm trying to create a custom javascript function for CKEditor but am unable to find anything on where to place this function within the existing CKEditor script.
If I add my function to the main textarea it doesn't work, I think this is because that textarea gets replaced with the instance of CKEditor.
Has anyone had any luck getting a onChange event to fire a custom function in Javascript? os seen an example of how to do this?
Thanks
If I add my function to the main textarea it doesn't work, I think this is because that textarea gets replaced with the instance of CKEditor.
Has anyone had any luck getting a onChange event to fire a custom function in Javascript? os seen an example of how to do this?
Thanks
You should also note that your code is excluding the last character (or keyboard action).
"hello" apears as "hell" but if you type "hello " and then hit backspace it apears as "hello " where is should display as "hello".
"hello" apears as "hell" but if you type "hello " and then hit backspace it apears as "hello " where is should display as "hello".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for info the textarea is hidden. It goal is to send on form submission the CKEditor code (equ of what you see on the screen)
You need to use the API : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.event.html#on
someObject = CKEDITOR.instances.ID_OF_YOUR_TEXTAREA
You need to use the API : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.event.html#on
someObject = CKEDITOR.instances.ID_OF_YOUR_TEXTAREA
someObject.on("change", function() {
alert("Changed !");
});
ASKER
The onKeyUp was very helpful. Thank you.
I'm sorry but this is not the right answer for CKEditor :o(
ths is incorrect for CKEditor .. but works for a plain textfield
You will also want to make sure that your onchange event is not being called except when you want it to occur.