Search code examples
javascriptjquerysharepoint-2010content-query-web-part

sharepoint content query webpart: hide empty column with jquery


I want to hide a list column in editform.aspx

</script>
<script language="JavaScript">
$(document).ready(function() 
{ $('nobr:contains("columnname")').closest('tr').hide()  });
</script>

It works. But now I want to hide it, if there is no value. How to do this?


Solution

  • $(document).ready(function() 
    { if ($('nobr:contains("columnname")').val() == "")
      {
        $('nobr:contains("columnname")').closest('tr').hide()
      }  
    });