Kosi2801 Kosi2801 - 6 months ago 22
HTML Question

Turn off enclosing <p> tags in CKEditor 3.0

Is there a possibility to turn off the automatic enclosing of all written content within <p></p> in CKEditor 3.x?

I tried


but this just changes the inline linebreaks to <br /> while leaving the enclosing paragraph.

Currently writing "Test" produces this output


but I want it to be simply


Is there a configuration property for this or would another inline editor to be better suited for this?

Answer Source

CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR; - this works perfectly for me. Have you tried clearing your browser cache - this is an issue sometimes.
You can also check it out with the jQuery adapter:

<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/js/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$(function() {
        toolbar: 'Full',
        enterMode : CKEDITOR.ENTER_BR,
        shiftEnterMode: CKEDITOR.ENTER_P

UPDATE according to @Tomkay's comment:

Since version 3.6 of CKEditor you can configure if you want inline content to be automatically wrapped with tags like <p></p>. This is the correct setting:

CKEDITOR.config.autoParagraph = false;

Source: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoParagraph

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download