1 |
|
2 | document.addEventListener( 'DOMContentLoaded', function() {
|
3 |
|
4 | // remove elements without text in any cells
|
5 | document.querySelectorAll( '.hide-with-empty-cells' ).forEach( function( container ) {
|
6 | var hasText = false;
|
7 | container.querySelectorAll( 'td' ).forEach( function( cell ) {
|
8 | if ( !hasText && cell.textContent.trim().length > 0 ) {
|
9 | hasText = true;
|
10 | }
|
11 | } );
|
12 | if ( !hasText ) {
|
13 | container.parentNode.removeChild( container );
|
14 | }
|
15 | } );
|
16 |
|
17 | } );
|