How to hide a version picker custom field using javascript?

tpham May 31, 2012

Hi,

Can anyone please provide a sample of how to do this?

Thanks,

2 answers

0 votes
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012
Try with following code

$("#customfield_10571").closest('div.field-group').hide(); $("#customfield_10571").closest('div.field-group').show();

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

Why do you need Javascript to do it? You can do it in field configurations or take it off from the screens.

But if you must do it using Javascript, here is a snippet that will work for any custom field including version picker.

AJS.$("#customfield_10000").parent().hide();

Where customfield id is 10000.

tpham May 31, 2012

It is not working for me, not sure if it's because I am using Jira 5

tpham May 31, 2012

I think I should specify few more things, I want to hide it even in view screen, here is my current code

<script type="text/javascript">

version = document.getElementById('customfield_10609');

version.closest('div.field-group').hide();

</script>

RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

if you want to hide the field in view screen just remove the field from view screen,

tpham May 31, 2012
But I only want to hide it from certain users
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

The above code does it only for edit. Try Prasad's solution if you want to hide it from View as well.

Suggest an answer

Log in or Sign up to answer