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(oFCKeditor.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)

Comments
blog comments powered by Disqus