Wednesday, June 15, 2011

How to get the value of a FCKeditor based using jQuery

Today I ran into the need to use jQuery AJAX on an FCKeditor box generated by . Since getting the value is a little complex and I didn't see any posts to help after some quick GoogleFu, I decided I would share this little snippet.

For my cftextarea I have it wrapped in a div that we will identify with a class of "fckEditorBox".

For the jQuery you can use:

var fck_iFrame = $(".fckEditorBox iframe").contents().find("#xEditingArea iframe");
var fckEditorVal = fck_iFrame.contents().find("body").html();

Now the html contents of the fckEditor are now stored in the fckEditorVal.

Enjoy.

Stumble Upon ToolbarDigg this Post This to FacebookShare on Facebook Tweet Me