Using jQuery to grab the content from CKEditor's iframe
Posted
by miCRoSCoPiC_eaRthLinG
on Stack Overflow
See other posts from Stack Overflow
or by miCRoSCoPiC_eaRthLinG
Published on 2009-05-29T02:28:41Z
Indexed on
2010/03/13
3:27 UTC
Read the original article
Hit count: 492
Hey guys, I have this custom written CMS that uses CKEditor *(FCKEditor v3) for editing content. Along with that I'm using the jQuery Validation plugin to check all fields for error prior to ajax-based submission. For passing on the data to the PHP backend, I'm using the serialize() function.
Problem is, serialize manages to grab all other fields correctly, except for the actual content typed in CKEditor. Like every other WYSIWYG editor, this one too overlays an iframe over an existing textbox. And serialize ignores the iframe and looks only into the textbox for content... which of course, it doesn't find - thus returning a blank content body.
My approach to this is to create a hook onto the onchange event of CKEditor and concurrently update the textbox (CKEDITOR.instances.[textboxname].getData() returns the content) or some other hidden field with any changes made in the editor.
However, since CKEditor is still in it's beta stage and severely lacks documentation, I cannot seem to find a suitable API call that'll enable me to do so.
Does anyone have any idea on how to go about this? Or maybe suggest even a better method?
© Stack Overflow or respective owner