Tuesday, June 18, 2013

Using JQuery to hide SharePoint 2013 List Item fields

Hiding unnecessary fields in DispForm.aspx/EditFOrm.aspx is something most of us implement within our SharePoint implementations. Here is a quick way to achieve that using JQuery.
Hiding any List Item fields
So you have many fields in your NewForm.aspx but you want to hide some like in the screenshot. I want to hide the fields I haven’t underlined.



I will click on Edit Page, and add a Script  Editor webpart on the page. From the below script, just change the number in which your fields appear on the page using a 0 index. So to hide the first field, enter 0, second field – enter 1 and so on.



Also you can do some formatting on your page using Jquery, for example I am making the font as BOLD for the list item entries.
$(".ms-formbody").css("font-weight","bold");

Also,
I want to hide the information in the screenshot, you can add this line as well.


$(".ms-descriptiontext").css("display","none");
Hope this helps someone looking for a similar scenario.

2 comments:

sven spillebeen said...

this does not work for me, i followed your page to the point but all is still showing.

Ekaterina Chursina said...

It worked! Great post. Thank you!