I have few radio buttons and the last one control the display of another set of radio buttons.
If the user clicks on the last one (the one with the sub-level .sub-question), I want to display the sub-level radio buttons.
My problem: actually if the user clicks on a sub-level radio button, it hides the .sub-question part.
What I used:
$('.form-group > label').find(' > input:checkbox, > input:radio').on('click', function() {
el = $(this).closest('.form-group').find('.sub-question');
if(el.length > 0) {
el.css('display', 'block');
}
else {
$('.sub-question').css('display', 'none');
}
});
My HTML is the following:
...
<div class="form-group">
<label>Item A
<input type="radio">
</label>
</div>
<div class="form-group">
<label>Item B
<input type="radio">
</label>
<div class="row sub-question">
<div class="form-group">
<label class="container_radio">Sub level 1
<input type="radio">
</label>
</div>
</div>
</div>
...
Complete HTML is in this jsFiddle: https://jsfiddle.net/fkL4dnj1/
But it doesn't work.
Could you please help me with this ?
Thanks.