Skip to content

Instantly share code, notes, and snippets.

@srkmrs
Last active December 20, 2015 22:59
Show Gist options
  • Select an option

  • Save srkmrs/6209447 to your computer and use it in GitHub Desktop.

Select an option

Save srkmrs/6209447 to your computer and use it in GitHub Desktop.
Find and hide the empty row
/**
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