Sunday, December 31, 2017

javascript Using CSS or Java to Show or Hide Empty Content Area

javascript Using CSS or Java to Show or Hide Empty Content Area




javascript - Using CSS or Java to Show or Hide Empty Content Area -

i trying create page template uses section headers , subsequent content beingness dynamically pulled in based on separate database. have page set this:

<tr> <td> <h3>product applications</h3> {tag_applications}<br /> </td> </tr>

where product applications formatted header on page , {tag_applications} link through cms pulling in content field defined elsewhere. trying figure out how hide entire cell (or div if need to) either css or script when {tag_applications} empty or blank. tried utilize empty tag in css on cell , setting display hidden, of course, cell not empty because of header.

what best way can accomplish without creating separate pages each item?

thanks!

try wrapping content area in div, this:

<tr> <td> <h3>product applications</h3> <div class="contentsection">{tag_applications}</div> </td> </tr>

then script can check if div empty or not. (uses jquery)

$(function() { $(".contentsection").each(function(idx, ele) { if($(ele).html() == "") $(ele).parent().hide(); }); });

my apologies if made syntax errors...

javascript jquery html css

go to link download
download
alternative link download

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.