Shaun Mccran

My digital playground

04
M
A
Y
2010

How to stop FCK Editor wrapping your content with 'P' tags

Whilst testing a website for WCAG 2 Accessibility compliance I noticed that all my dynamic content from a database was wrapped in the HTML 'P' element.

The functionality that put the content into the database was a rich text area using the inbuilt FCK Editor. This article deals with how to stop FCK editor wrapping your content in undesirable tags.

This variable to control what FCK editor wraps your content in is called the 'EnterMode'. This is variable read from the 'fckconfig.js' file, which is located in the 'webroot\CFIDE\scripts\ajax\FCKeditor\' directory. It basically specifies whether to wrap your text in a 'p', 'div' or 'br' tag. In my case I am outputting a header element, and FCK Editor is adding a 'P' tag inside the 'H1', which is not valid html.

view plain print about
1<h1> <p>Header text goes here</p></h1>

Find the line that looks like this in your fckconfig.js file.

view plain print about
1FCKConfig.EnterMode = 'p' ; // p | div | br

Change the value to 'br' and refresh your browser cache. Any new content submitted through the rich text area will not be surrounded in 'P' tags.

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Back to top