I am trying to display a Label type field only on the condition that the Issue type is Inspection Defect. This is the code that I am using:
<script type="text/javascript">
issuetype = document.getElementByName('issuetype');
if (issuetype)
{ target = document.getElementById('customfield_11200'); // Hide the target field if issuetype not Inspection Defect
if (issuetype.value != 7)
{ target.style.display='none';
}
else
{ target.style.display='inline';
}
}
</script>
Please let me know if I need to change anything.
Hi;
Are you sure getElementByName is compatible with the browser? It's not a native function for all browsers.
Maybe ujse jQuery to be more cross-browser compatible? Will be easier for you to hide/show the element too.
In JIRA 4.4, you can do something like this:
<script type="text/javascript"> if (AJS.$("input[name=issuetype]").val() != 1){ AJS.$(".aui-field-labelpicker").hide(); } </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.