- Posts: 13715
- Thank you received: 4200
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var thisQuestion = $('#question{QID}'); var thisQuestionID = '{QID}'; var qHidden = $(thisQuestion).nextAll('.multiple-opt:eq(0)'); var qHiddenID = $(qHidden).attr('id').split('question')[1]; // Hide the checkbox question qHidden.css({ 'position': 'absolute', 'left': '-9999em', 'top': '-9999em' }); // Listener on the radios $('input.radio', thisQuestion).on('click', function(e) { var thisSQCode = $(this).attr('name').split('X'+thisQuestionID)[1]; var hiddenCheckbox = $('input.checkbox[id$="X'+qHiddenID+thisSQCode+'"]'); // Toggle the hidden checkbox if($(this).val() > 6) { hiddenCheckbox.prop('checked', true); hiddenCheckbox.nextAll('input:hidden').val('Y'); } else { hiddenCheckbox.prop('checked', false); hiddenCheckbox.nextAll('input:hidden').val(''); } // Fire Expression Manager checkconditions(hiddenCheckbox.value, hiddenCheckbox.name, hiddenCheckbox.type); }); }); </script>