Hi folks,
Please see the below function which is meant to make different type of SharePoint fields as Read-Only.
function SetReadOnlycolumn(){
$("input[title='FieldName1']").attr("readonly","true"); ////Single-line of text field
$("select[title='FieldName2']").attr("disabled","disabled"); //Choice field
$("input[title='FieldName3'], textarea").attr("readonly","readonly"); //Multiple-lines of text field
$("#ctl00_ctl40_g_46606705_ff1e_460d_8675_2f9815d404c6_ff61_ctl00_ctl00_BooleanField").attr("disabled", "disabled"); // Yes/No field----Field4
$("input[title='FieldName5']").attr("readonly","true"); // Number field
}
Also, find the below syntax to block/disable the fields of type input(textbox, checkbox), select(dropdown / choice field) and textarea (Multiple Lines of text) in one step
$('#DivId').find('input, textarea, select').attr('disabled','disabled');
DivId is the ID of the div tag.
Note: Don't use <div> tag within <table> or <tr><td> tags. In that case, please use <tbody> within <table> or <tr><td> tags.
Please see the below function which is meant to make different type of SharePoint fields as Read-Only.
function SetReadOnlycolumn(){
$("input[title='FieldName1']").attr("readonly","true"); ////Single-line of text field
$("select[title='FieldName2']").attr("disabled","disabled"); //Choice field
$("input[title='FieldName3'], textarea").attr("readonly","readonly"); //Multiple-lines of text field
$("#ctl00_ctl40_g_46606705_ff1e_460d_8675_2f9815d404c6_ff61_ctl00_ctl00_BooleanField").attr("disabled", "disabled"); // Yes/No field----Field4
$("input[title='FieldName5']").attr("readonly","true"); // Number field
}
Also, find the below syntax to block/disable the fields of type input(textbox, checkbox), select(dropdown / choice field) and textarea (Multiple Lines of text) in one step
$('#DivId').find('input, textarea, select').attr('disabled','disabled');
DivId is the ID of the div tag.
Note: Don't use <div> tag within <table> or <tr><td> tags. In that case, please use <tbody> within <table> or <tr><td> tags.
No comments:
Post a Comment