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 Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

576 views 1 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