On the issue creation I now hide field depending on select list (single choice) field value with the code below. Now I want to hide the field depending on the Radio Buttons field value.
If I replace the id of the select list field with radio buttons field id - the code stops working. It seems that the Radio Buttons requires code modifications.
customfield_13000 - is the Radio buttons field
customfield_10701 - is the field that I hide
What should be added instead of these lines to make the code working with radio buttons?
1st line for replacement
$('#customfield_13000').change(function()
2nd line for replacement
if($("#customfield_13000 option:selected").text() == 'Yes')
The code for hiding field depending on select list value:
<script type="text/javascript">
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
callShowHideFunctions();
});
callShowHideFunctions();
function callShowHideFunctions(){
showHidefields();
$('#customfield_13000').change(function() {
showHidefields();
});
}
function showHidefields(){
$('#customfield_10701').closest('div.field-group').hide();
if($("#customfield_13000 option:selected").text() == 'Yes'){
$('#customfield_10701').closest('div.field-group').show();
}else{
$('#customfield_10701').val('');
$('#customfield_10701').closest('div.field-group').hide();
}
}
});
</script>
I've tried the following replacements found in the code from request https://community.atlassian.com/t5/Answers-Developer-Questions/Hide-a-radio-button-field/qaq-p/524227 but they don't work
1st line replacement (doesn't work)
$('input:radio[name=customfield_13000]').click(function()
2nd line replacement (doesn't work)
if($('input[name=customfield_13000]:checked + label').text() == 'Yes')