Last active
December 20, 2015 22:59
-
-
Save srkmrs/6209447 to your computer and use it in GitHub Desktop.
Find and hide the empty row
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Once the dom is rendered or ready , invoke or call the method named hideEmptyRows. | |
| How to call | |
| hideEmptyRows(1000); | |
| or | |
| hideEmptyRows(); | |
| Preferable | |
| hideEmptyRows(10); | |
| **/ | |
| function hideEmptyRows(delay){ | |
| if(delay){ | |
| /** The following style applied for testing purpose.**/ | |
| $( "div.row" ).css( "border", "1px solid green" ); | |
| setTimeout(findAndHideEmptyRows,delay); | |
| }else{ | |
| findAndHideEmptyRows(); | |
| } | |
| } | |
| function findAndHideEmptyRows(){ | |
| $("div.row:empty").css("display","none"); | |
| /** If browser does not support the above expression, | |
| Please uncomment the following script and run. **/ | |
| /* | |
| $("div.row" ).each(function( index ) { | |
| var content = $(this).text(); | |
| var display = false; | |
| if(content != null){ | |
| content = $.trim(content); | |
| if(content.length > 0){ | |
| display = true; | |
| }else{ | |
| display = false; | |
| } | |
| } | |
| if(!display){ | |
| $(this).css("display","none"); | |
| } | |
| }); | |
| */ | |
| /** The applied style removed after testing. **/ | |
| $( "div.row" ).css( "border", "0px" ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment