I have a javascript at a custom fields to hide/show the field based on another field value.
It works fine when I create an issue.
The problem is when I change the project or the issue type. When I do this it seems that I don't have a javascript.
One of the javascripts that I use is:
<script>
checkbox_11106_1 = document.getElementById('customfield_11106-1'); //New - Yes
checkbox_11106_2 = document.getElementById('customfield_11106-2'); //New - No
if (!checkbox_11106_1.checked){
AJS.$("#customfield_11118").closest('div.field-group').show();
}
if (!checkbox_11106_2.checked){
AJS.$("#customfield_11118").closest('div.field-group').hide();
document.getElementById('customfield_11118').value = '';
}
checkbox_11106_1.onclick=function(){
if (checkbox_11106_1.checked){
AJS.$("#customfield_11118").closest('div.field-group').hide();
document.getElementById('customfield_11118').value = '';
}
};
checkbox_11106_2.onclick=function(){
if (checkbox_11106_2.checked){
AJS.$("#customfield_11118").closest('div.field-group').show();
}
};
</script>
How can I resolve this problem?