Having trouble with hiding entire field based on output from a previous field.

So, first I have all of 3 hour of exposure to javascript, so bare with me.

<script type="text/javascript">
jQuery(document).ready(function()
{
checkbox = document.getElementById('customfield_11540-1');
dept = document.getElementById('customfield_11534');
prog = document.getElementById('customfield_11537');
func = document.getElementById('customfield_11533');
// Hide the target field by default
dept.style.display = '';
prog.style.display = 'none';
func.style.display = 'none';

checkbox.onclick=function() {
if (checkbox.checked) {
prog.style.display = '';
func.style.display = '';
dept.style.display = 'none';
} else {
prog.style.display = 'none';
func.style.display = 'none';
dept.style.display = '';
document.getElementById('customfield_11534').value = '';
}
};

});

</script>

Ive pieced together this from previous posting on the subject.

So it does sort of work, the fields for prog and func are drop menus, and it hides the menu part, but not the field label. I read that from Jira4.2 and newer, were supposed to use .parentNode; to include the entire container, that breaks the script in my case. Kind of scratching my head getting the intended outcome.

1 answer

Disregard, I forgot to refresh my second page that I was using to test the create issue.

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,831 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