Using jQuery to Prefill and Disable Required Columns in a SharePoint Form


<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.4.2.min.js"></script>

2<script language="javascript" type="text/javascript">
3  $(document).ready(function() {
4    $("input[Title='Title']").val("Hello World");
5    $("input[Title='Title']").attr("disabled", "disabled");
6  });
7  
8  function PreSaveAction() {
9    $("input[Title='Title']").attr("disabled", "");
10    return true;
11  }
12</script>
 
 
********************************************************************
 
if you need to know if a specific object is visible:
if ( $('#myitem').is(':visible')){
// perform logic if the item is visible..
}

************************************************

Comments

Popular posts from this blog

SharePoint 2016 and 2019 Ports

Unlock the SharePoint site using Powershell command

PsConfig step by step /Configuration Wizard. “Upgrade Available” vs “Upgrade required”