How do I remove an empty tag from CKeditor? I've tried:

Regex.Replace(clean, "(<[/a-zA-Z]+?)([^>]*?)(>)", "$1$3");

Regex.Replace(input, @"<([^>/][^>]*)>((&nbsp;)*|\s*)</\1>", String.Empty);

config.allowedContent = true;

config.removeFormatAttributes = '';

in config.js of ckeditor but it didn't work.


Sounds similar like this question here: CKEditor strips <i> Tag

It should be possible to define if the tags are allowed to be empty or not:

// allow i tags to be empty (for font awesome)
CKEDITOR.dtd.$removeEmpty['i'] = false

If you would allow disallow it for every tag, they should get removed.

I only played with the 'i' tag case in the past. But I believe it is possible with all other tags as well.

  • thank you for your response but this is not working in my project – Akash Shrivastav Sep 16 '15 at 12:55
  • Is there a JSFiddle or something of what you are trying to do? – Matthias Jost Sep 16 '15 at 13:34

Your Answer

