Using contents of placeholder in a conditional

Using contents of placeholder in a conditional

I'd like to use the contents of a placeholder as a conditional in a web block.

My web block has two placeholders--one for a header and one for a body.  I want to have the header placeholder only visible (in the web browser) if the user has entered text into it.

At first I was using a boolean input parameter "HasHeader" with an If widget that would show the header placeholder if HasHeader was true.  This struck me as an unnecessary parameter and I could accomplish the same output by hiding the header if no text was present in the placeholder.

In the If widget, I'm not sure how to reference the text within the placeholder, I'm trying to do something like:
    Header.Text <> ""

It gives me access to the Header placeholder itself, but the only attribute it gives me is "Id" for the runtime ID.

Any help is appreciated.
I came up with a solution that I'm not very happy with, but I'll note it nonetheless.

I wrote a small JavaScript snippet that will use the Runtime ID to remove the DOM element if the element is empty:

"<script type='text/javascript'>
!function () {
    var header = $('#' + '" + Header.Id + "'.replace(':', '\\:'));
    if (header.html() === '') header.remove();
This is in an expression in the web block.