Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

show text field only when radio button is clicked, plz suggest the javascript and where to embed it on jira 4.4

navneet nischal January 22, 2012

<script type="text/javascript">
field = document.getElementById('customfield_10106');
if (field)
{
target = document.getElementById('customfield_10107');
target.style.display='none';

if (field.value != 'yes') target.style.display='none';

field.onchange=function()
{
if (this.value == 'yes')

{ target.style.display = ''; }
else

{ target.style.display='none'; }
}
}
</script>


i guess there is the mistake because it does not work. plz specify for where do i write the code in jira so as it works

1 answer

1 vote
Dieter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2012
If you do not put this code in document ready handler the getElementById might return null since the DOM tree is not built yet completely when you just add the code to a custom field description. Please put your code in a ready handler like in this answer: https://answers.atlassian.com/questions/33517/hide-tabs-like-issue-types-etc-from-project-role-administrators?page=1 Let us know how it goes. I'd also suggest to invest time in learning jQuery. As you can see from the above link this helps create short, yet readable solutions

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events