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

This widget could not be displayed.

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

This widget could not be displayed.

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

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

Hi

Can the tab be shown only for a particular role?

Thanks

Abe

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

83 views 1 0
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