This block of code belongs to a joomla module that posts articles.The problem is that inside this div
<div class="ns2-row <?php echo $j==0 ? 'ns2-first' : '' ?> <?php echo $j%2 ? 'ns2-even' : 'ns2-odd' ?>">
Its getting posted the article and 4 more divs that are completly empty. Theese divs are getting padding + border from css. ( they use the same class as the article so i cant just display:none em ).I dont like the output and i would like to remove any div that is empty.My first touch with jquery was today and after some searching i reached to the below code that dont seem to work. I pasted only the block of code i want to edit.
<div class="ns2-page <?php echo $anim_class; ?>">
<div class="ns2-page-inner">
<?php for($j=0;$j<$article_row;$j++, $i++): ?>
<div class="ns2-row <?php echo $j==0 ? 'ns2-first' : '' ?> <?php echo $j%2 ? 'ns2-even' : 'ns2-odd' ?>">
<div class="ns2-row-inner">
<script>
$('div').filter(function () {
return $.trim($(this).html()).length == 0;
}).hide();
</script>
i tried it and as return $.trim($(this).text()) === ''; but also nothing happened ? i do something wrong ?