Hod 자식 div 인 RelatedEventsList가 비어 있으면 부모 div를 숨 깁니다.자식 div가 비어있는 경우 부모 div 숨기기
<div class="EventsRollup">
<span class="EventsRollupTitle">CPR & Health Safety Classes</span><br /><br/>
<div class="RelatedEventsList">
<!--EMPTY with a lot of whitespaces etc. but no text-->
</div>
</div><!--END EventsRollup-->
왜 이렇게하지 않습니까?
var listtext=$.trim($('.RelatedEventsList').text());
if (listtext===""){
$('.EventsRollup').hide();
}
null 대신 길이를 비교해 보았습니까? –
잘 작동합니다 : http://jsfiddle.net/3E3Y2/. –
나를 위해 작동합니다 : http://jsfiddle.net/3V5Vs/ –