Making a form field disabled in SharePoint with jQuery

With InfoPath on its way out, I have been looking into different options for a form solution. In some cases the simple out-of-the-box new, edit, and view aspx forms are enough (even though they are ugly) with some minor tweaks. One of the most common tweaks I need to make is to make a field disabled (or read-only). By using jQuery to set the field properties to disabled I can control what fields should be read-only.

<script src="jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">


$("select[Title='Request Status']").prop("disabled", true);  //disable a dropdown
$("input[Title='Requester']").prop("disabled", true);  //disable a text field



Using the ‘title’ attribute of the element (example: [Title=’Request Status’] ) allows us to select which field to disable. Mark Rackley has a really good post that covers using attributes to select an element.