How to hide fields in SharePoint display form using Javascript in SharePoint 2010/2013/2016 /2019 and office 365?

Hello SharePointers,

If you add external column in list, those columns will be visibile in your sharepoint display form by default. To hide sharepoint fields in sharepoint display form, you have to write the below script.

<script language=”javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script><script language=”javascript”>

$(document).ready(function () {

$(“.ms-standardheader:contains(‘FieldName1’)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName2)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName3’)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName4)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName5)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName6’)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName7’)”).closest(“tr”).hide();
$(“.ms-standardheader:contains(‘FieldName8’)”).closest(“tr”).hide();

});

</script>​​​<br/>​<br/>

 

Happy SharePointing 🙂

Leave a Reply

Your email address will not be published.