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

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

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.

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.

The above code should hide the link.

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

It dint work. Can you please elaborate.

where is the code?

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

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


This code worked. Thanks for the help.

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

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

var tab = "#tab2";

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

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

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

0 votes
David Simpson Community Champion Jan 30, 2012
This is very vague. Please be explicit in what you want. Maybe an annotated screenshot would help.

Hi

Can the tab be shown only for a particular role?

Thanks

Abe

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,905 views 12 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot