I have read loads of posts on various forums and here on SO, and still seem unable to prevent tinymce from stripping empty tags from the end of an editable block.
E.g. I input this:
<a href="blah">zzz</a> <div class="floatClearer" style=""></div>
..and upon round trip (in and out of HTML mode), tinymce strips off the entire <div class="floatClearer" style=""></div>
.
As per various bits of advise I found, I tried these things, and more:
div
in my valid_elements
,...and these config. options:
verify_html : false,
extended_valid_elements : "div*",
extended_valid_elements : "div[*]",
ALL to no avail. is there any way to prevent that stripping action? There are other places I need empty tags (not just in this one example), so please, if you can, let me know an answer specific to my question, as opposed to suggesting I not use empty tags.
There was a bug in TinyMCE, and now it's fixed (in v3.5.2). Thanks to @Thariama!
For future searchers: Use the verify_html
option.
This option enables or disables the element cleanup functionality. If you set this option to false, all element cleanup will be skipped but other cleanup functionality such as URL conversion will still be executed.
Example of usage:
tinyMCE.init({ ... verify_html: false });
As I do too have troubles, I am adding my brick - on top of Cliff Ribaudo answer.
So I recommend using
inside the empty tag which won't be stripped and won't be visible, not even by search engines.
Doing like so have not been stripped on my tinyMCE: <div class="someclass"> </div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With