How Do I Output HTML Instead of XHTML Code Using CKEditor?

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

If you want CKEditor to output valid HTML4 code instead of XHTML, you should configure the behavior of the dataProcessor.

For some tips on how to achieve this, check the Output Formatting section of CKEditor 3.x Developer's Guide as well as the Output HTML (output_html.html) and Output XHTML (output_xhtml.html) samples that can be found in the _samples directory of CKEditor installation package.

If, for example, you want CKEditor to output the self-closing tags in the HTML4 way, creating <br> elements instead of <br />, configure the selfClosingEnd setting in the following way.

CKEDITOR.on( 'instanceReady', function( ev )
    {
        ev.editor.dataProcessor.writer.selfClosingEnd = '>';
    });
This page was last edited on 7 March 2011, at 13:34.