I am attempting to lock down some fields in the Edit Form so that the data cannot be accidentally changed.

I am knowledgeable of how to use script and content editor web parts, so I am able to insert script.

I tried this script, but it did nothing:

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"

<script type="text/javascript">

//Set the Field to Read only and change its background colour
$("input[title='Metrics ID']").attr("readonly","true").css('background-color','#F6F6F6');
//You can disable the field also:  $("input[Title='Metrics ID']").attr("disabled", "disabled");


Any advice or resources would be very appreciated. Thanks! Oh, and I am working in SharePoint 2013.


2 Answers 2


You can use SPUtility.js for hide and read only fields in SharePoint forms.

Reference link: https://sputility.codeplex.com

  • Thanks. Is this easy to implement for someone who is not familiar with javascript?
    – cbbrown
    Commented Feb 23, 2017 at 15:11
  • Yes very easy just need to add this JS reference file and then put your read-only code in document.Ready(). Commented Feb 23, 2017 at 15:15
  • Add the reference file to the Site Assets and connect to it with a Content Editor? Sorry, I've only done what I consider simple script additions.
    – cbbrown
    Commented Feb 23, 2017 at 15:18
  • Yes add file into site assets and then reference that file into content editor web part. Commented Feb 23, 2017 at 15:55
  • Got it. I found this step by step guide. sputility.codeplex.com/… Thanks for your help!
    – cbbrown
    Commented Feb 23, 2017 at 16:05


Looking at sputility in GitHub -- it replaces <input>s and other fields with plain text, which is a good way to communicate read-only-ness.

Similarly, you can hide the input field and put the text value right after it:

var $metricsId = $("input[title='Metrics ID']");  // In case you're gonna use it again
$metricsId.hide().after($metricsId.val());        // Hide input element & put value after it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.