How to make a Sharepoint List column Readonly in SharePoint 2013

In one of my previous project, we had to maintain  readonly column in sharepoint list  in edit form. How to achieve this?
There are many ways to implement readonly column.
 
1.Powershell Script to make sharepoint columns as read only
2. Using SharePoint Designer
3.Using  jquery in Content Query Web Part.
 
In this blog, we will implement this using SharePoint Designer. Add the below piece of javascript code in the Edit Form of the Custom List. 

<script type=”text/javascript”>

function SetReadOnlycolumn()

{

var elements=document.getElementById(’your text field column name’);

elements.readOnly=true;

}

_spBodyOnLoadFunctionNames.push(“SetReadOnlycolumn()”);

</script>

 Happy SharePointing:-)
Ebook Download
View all
Learn
View all