Get the HTML from an FCKEditor instanceGet 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:

Comments

blog comments powered by Disqus