Remove edit button on label field

Hi!

I have a custom field (label-type) called "Reporter Department Code". I want to have it as a label field but I don't want the edit button on issue view screen:reporter_department_code_label.PNG

I have seen that there is a solution for this with the assignee field, inserting javascript code on field description:

<script type="text/javascript"> 
var removeCTE = setInterval(function() {
var editableElms = AJS.$('#assignee-val')
if (editableElms.length) { 
editableElms.removeClass('inactive'); 
editableElms.removeClass('editable-field'); 
editableElms.removeAttr('title'); 
editableElms.find('span.overlay-icon').hide(); 
}},500);
</script>



I am trying to use this method to remove the edit button pencil on my "Reporter Department Code" but I do not succeed:

<script type="text/javascript"> 
var removeCTE = setInterval(function() {
var editableElms = AJS.$('#edit-labels-1047756-customfield_13500')
if (editableElms.length){ 
editableElms.removeClass('aui-icon'); 
editableElms.removeClass('aui-icon-small');
  editableElms.removeClass('aui-iconfont-edit');
editableElms.removeClass('edit-labels');
editableElms.removeAttr('href'); 
}},500);
</script>


What am I doing wrong? Is it possible to remove the edit button (pencil) from issue view screen? Making the custom field as an text-field is not an option, I want to have a label-field.

Br, David Henriksson

1 answer

0 votes
Avdhesh Chauhan May 19, 2017

Hi There, 

Just remove that field from Edit screen , that will solve your problem.

Thanks

Hi!

No that doesnt solve the problem. My field "Reporter Department Code" is not in Edit screen and the pen is still visibile.

Suggest an answer

Log in or Sign up to answer