Get the HTML from an FCKEditor instance
Posted March 29th, 2009 in FCKEditor
FCKEditor is an in-browser WYSIWYG HTML editor and I post an FCKEditor tutorial roughly every ten days. This post looks at how to get all the HTML from an FCKEditor instance. The next couple of posts will then look at how to get just what's selected and then how to do a custom save function.
Our example FCKEditor instance is named "html" (created by e.g. $oFCKeditor = new FCKeditor('html'); in PHP).
To simply show all the HTML in the current FCKEditor in a window.alert dialog call the following function from a button etc:
function show_html() {
var oFCKeditor = FCKeditorAPI.GetInstance('html');
window.alert(oEditor.GetData());
}
You could do other more useful things than showing it in an alert dialog and I will show how you could then override the save function in a later post and potentially save the modification using AJAX.
Related posts:
- Get the selected HTML from an FCKEditor instance (Friday, April 17th 2009)
- Getting a handle to an FCKEditor Editor Instance (Tuesday, March 17th 2009)
- Insert HTML into FCKEditor (Friday, February 13th 2009)
- Always make FCKEditor paste as plain text (Tuesday, November 11th 2008)
- Using the FCKEditor HTML Editor with PHP (Wednesday, August 20th 2008)
Subscribe / Follow / Email / Bookmark / Share
Use the buttons below to subscribe to my RSS feed to be notified next time something is posted, share this post with others, or subscribe by email to have my posts sent in a daily email, follow me on Twitter or follow me on Facebook.
At least one new post is usually made every day. See my posting schedule for more details.
