Hide List Form Field in SharePoint 2013 using jQuery

My earlier post listed various methods such as C# Object model, PowerShell, JavaScript methods to hide columns in SharePoint list forms: Hide Columns in SharePoint List NewForm, EditForm and DispForms

Now, lets hide fields in SharePoint list form pages using jQuery. Lets say you have a field called "Parent Project" and want to hide it from All SharePoint list forms such as NewForm.aspx, EditForm.aspx and DispForm.aspx.

jQuery script to hide SharePoint field in New, Edit and Display Forms:
<script src="http://code.jquery.com/jquery-1.2.6.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('td.ms-formlabel:contains("Parent Project")').parent().hide();

These scripts can be placed in Script Editor web part, Custom JS file linked in Master page or as part of SharePoint delegate controls.

To hide fields in SharePoint list form pages using jQuery, Navigate to Newform.aspx or any other form page, Click on site settings icon >> Edit page >> Insert a Script editor web part and paste the above codes accordingly.
hide sharepoint list column using jquery
Consider downloading and placing jQuery js file to your SharePoint hive in case, for faster retrieval.
E.g. Instead of "http://code.jquery.com/jquery-1.2.6.min.js", you'll placing it in _layouts folder and referring as: http://teamsites.crescent.com/_layouts/jquery-1.2.6.min.js

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.