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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You will probably need to create an instance of the object in your header, then call it with the onchange event in the body.
You will also want to make sure that your onchange event is not being called except when you want it to occur.
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".
try using "onkeyup" instead of "onkeydown"!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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 :

someObject = CKEDITOR.instances.ID_OF_YOUR_TEXTAREA

someObject.on("change", function() {
     alert("Changed !");

Open in new window

elliottbenzleAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.