I am trying to make a custom text field read-only on the edit screen of jira using javascript, but looks like below code is not working.
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e,context) {
var projectName = AJS.$("#project-name-val").text();
console.log("RFC projectName "+projectName);
if (projectName == "RT")
{
callReadonlyFunction();
}
}
});
function callReadonlyFunction(){
$('#edit-issue').click(function() {
console.log("Edit Button Clicked Start");
AJS.$("#customfield_13911").attr("readonly", true); //text field
console.log("Edit Button Clicked End");
});
} In the console log, I do see messages but for some reason, the field is not set to read-only.