javascript - How to hide a DIV if content are missing -
javascript - How to hide a DIV if content are missing -
i have div has contents auto generated ektron cms.
screenshot of source:
output:
each parent div ({letter}serv
) empty if div class justpad
doesn't appear @ to the lowest degree once. based on screenshots, , c has content b , d doesn't.
how can hide {letter}serv
div if there no content within it?
i have next class can apply:
.hidediv { display: none; }
sample code:
<div id="nserv" class="serviceholder hidoverflow percpadbottom lettercode"> <h2 class="defaultblue percpadbottom">n</h2> <span id="ctl00_bodyplaceholder_collection15"> <a href="#vieweditorsmenu" data-ektron-editorsmenu-id="ektroneditorsmenu3c275505-4a2c-4384-bf36-081bc3e69279" onclick="return false;" class="ektroneditorsmenumarker"><img src="/workarea/images/application/pin_grey.gif" alt="editor's menu" title="editor's menu" /></a> <ul id="ektroneditorsmenu3c275505-4a2c-4384-bf36-081bc3e69279" class="ektroneditorsmenu" style="display:none;"> {contents} </ul> <div class="justpad"><a class="defaultlinks" href="link">nephrology</a></div> <div class="justpad"><a class="defaultlinks" href="link">neurology</a></div> <div class="justpad"><a class="defaultlinks" href="link">nutrition</a></div> </span> </div> <div id="bserv" class="serviceholder hidoverflow percpadbottom lettercode"> <h2 class="defaultblue percpadbottom">b</h2> <span id="ctl00_bodyplaceholder_collection15"> <a href="#vieweditorsmenu" data-ektron-editorsmenu-id="ektroneditorsmenu3c275505-4a2c-4384-bf36-081bc3e69279" onclick="return false;" class="ektroneditorsmenumarker"><img src="/workarea/images/application/pin_grey.gif" alt="editor's menu" title="editor's menu" /></a> <ul id="ektroneditorsmenu3c275505-4a2c-4384-bf36-081bc3e69279" class="ektroneditorsmenu" style="display:none;"> {contents} </ul> </span> </div>
this should find of empty divs , hide them.
$('div.serviceholder:not(:has(div.justpad))').hide()
javascript jquery html css ektron
Comments
Post a Comment