Show/Hide Checkbox Field based on Component Edited

This is the code I'm using but it does not seem to work

<script type="text/javascript">
component = document.getElementById('component');
if (component) {
target = document.getElementById('customfield_13300');
// Hide the target field if component isn't (02) Build
if (component.value != '(02) Build') target.style.display='none';

component.onchange=function() {
if (this.value == '(02) Build') {
target.style.display = '';
// target.value="enter message here";
} else {
target.style.display='none';
}
}
}
</script>

Basically, if the component is not (02) Build, my Checkbox field should not be shown. Upon trying the above field, it is still showing on all cases.

customfield_13300 is a checkbox field.

1 answer

Hi Marc,

May I ask if you have Script Runner for JIRA server installed (I am asking because one of the tags you used is the ScriptRunner key) ?

If that is the case that did you try to use a ScriptRunner Behaviour ?

regards, Thanos

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 ...

3,026 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