Hiding Empty Columns in Display and Edit form using JavaScript/JQuery
To Hide columns in Display and Edit form both from SharePoint that are empty, for that you don't have get into custom code. A simple client side script is used in form of Jquery.Code is as follows:
<script type=”text/javascript” src=”/Kishan/Scripts/jquery-v1.7.2.min.js”></script>
< script type=”text/javascript”>
$(“td.ms-formbody”).each(function()
< script type=”text/javascript”>
$(“td.ms-formbody”).each(function()
{
// Remove all the white spaces
// Remove all the white spaces
var val = $(this).text().replace(/\s|\xA0/g,”);
// We will check the string length if it's "0" , hide the field
if(val.length==0){
$(this).parents(‘tr:first’).hide();
}
});
$(this).parents(‘tr:first’).hide();
}
});
< /script>