• As anyone who’s ever done any HTML/CSS/jQuery coding will know,
    empty DIV tags certainly have their uses.

    Using

    <div id="placeholder"></div>

    for example is a stock standard way of using background images.

    Its incredibly frustrating that WordPress WYSIWYG editor
    strips these out! You can add them to your page in HTML view
    but any time you save in WYSIWYG (or your client does) the tags get
    stripped for all eternity.

    I’ve found workaround is to put a decimal stop between the tags and
    then hide it with

    CSS display:none

    but it seems a bit kludgy and surely unnecessary?

    I DONT wish to go hacking the core code to modify the allowable HTML tags.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter TWD

    (@twd)

    Anyone?

    Why not try adding &nbsp; between the div tags?

    Thread Starter TWD

    (@twd)

    Yeah, but it seems like a bit of a kludge doesn’t it?

    My point is that there must be a better way.

    It strips out the &nbsp; too. If I enter <div id="placeholder">&nbsp;</div> in the html editor then switch to the wysiwyg editor and back again to html then the &nbsp; is gone leaving just <div id="placeholder"></div>. Now if I switch to wysiwyg and back again that div placeholder is gone too. What gives?

    I was having same issue with &nbsp; getting stripped in wysywig. My solution is pretty rough but seems to work:

    <div id="map"><span style="display: none;">nothing</span></div>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to stop WP stripping out empty DIV tags’ is closed to new replies.