How to hide a tab in a screen using java script in jira 4.4.4

Smruti Panda January 30, 2012

When I try to hide a tab, only the contents of the tab get hidden, but the tab remains as a href. Is there any way, the tab can be completely hidden as if it were not there?

4 answers

1 accepted

0 votes
Answer accepted
JamieA
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.
January 30, 2012

What is the code that you are using? Not tested but something like this shd work to hide all except the main tab:

AJS.$("a[href='#tab2']").closest("li").hide()

How do you mean "remains as a href"? The html is always going to be in the source so people can get to it if they really wanted to.

Smruti Panda January 30, 2012

Remains as a href as in the link to the tab does not get hidden. I want to hide the link as well. I dont want the tab link to show up until some event has occured like an option has been selected or so.

JamieA
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.
January 30, 2012

The above code should hide the link.

Smruti Panda January 30, 2012

I tried document.getElementById('customfield_10018').closest(".tabs-pane").not(".active-pane").hide();

It dint work. Can you please elaborate.

Smruti Panda January 30, 2012

where is the code?

JamieA
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.
January 30, 2012

Say I want to hide the second tab, this works for me:

AJS.$("a[href='#tab2']").closest("li").hide()


Smruti Panda January 30, 2012

This code worked. Thanks for the help.

Smruti Panda January 30, 2012

The tab2 is hard-coded there. Is there any way i can make use of variables?

JamieA
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.
January 30, 2012

I've updated my answer, can you mark it as correct.

var tab = "#tab2";

AJS.$("a[href='" + tab + "']").closest("li").hide()

Teja June 22, 2017

Hi Jamie,

The above script how to add screen id, so that conflict will not happen for other screens of the other project.

if I choose "#tab2" it will affect to other project screen tab.

please help me

0 votes
AbrahamA
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.
July 17, 2012

Hi

Can the tab be shown only for a particular role?

Thanks

Abe

0 votes
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 30, 2012
This is very vague. Please be explicit in what you want. Maybe an annotated screenshot would help.
0 votes
Smruti Panda January 30, 2012

Remains as a href as in the link to the tab does not get hidden. I want to hide the link as well. I dont want the tab link to show up until some event has occured like an option has been selected or so

Suggest an answer

Log in or Sign up to answer