javascriptphptinymce-3

TinyMCE 3.x stripping out empty classes


I'm using TinyMCE 3.x and can't find the documentation for a problem I'm having.

If I use the html editor to add an empty element such as <div class="clearfix"></div> or <span class="clearfix"></span>, the editor removes these automatically.

Is there a way to tell it to stop stripping out empty elements?

I have found

extended_valid_elements :  "#div, #span",

which almost fixes it. If I enable this and add <div class="clearfix"></div>, it replaces it with <div>&nbsp;</div>, so adds a space but removes the class.


Solution

  • the class attribute seems to get stripped out, so try to make it valid like this:

    extended_valid_elements : "#div[class], #span[class]"