- Posts: 40
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
$(document).ready(function() { var prevAns = "{C1.NAOK} " === "2" && "{C2.NAOK} " === "2" ; if(prevAns) { $(".radio:eq(2),.radio:eq(3)").attr("disabled",true); } });
Here is an example for your situation.I think it's different case. hmmm...
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the elements var qHidden = $('#question{QID}'); var qC1 = qHidden.prevAll('.list-radio:eq(1)'); var qC2 = qHidden.prevAll('.list-radio:eq(0)'); var inputs = $('input[type="radio"]', qC1).add('input[type="radio"]', qC2); // Hide the filter question qHidden.hide(); // Listener on C1 and C2 $(inputs).click(function(e) { // Toggle the checkboxes in the hidden question if ($('input.radio:last', qC1).is(':checked') || $('input.radio:last', qC2).is(':checked')) { $('input.checkbox', qHidden).prop('checked', true); $('li.question-item input[type="hidden"]', qHidden).val('Y'); } else { $('input.checkbox', qHidden).prop('checked', false); $('li.question-item input[type="hidden"]', qHidden).val(''); } // Fire the array filter $('input.checkbox', qHidden).each(function(i) { checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type')); }); }); }); </script>