- Posts: 5
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" data-author="Tony Partner"> $(document).ready(function() { var thisQuestion = $('#question{QID}'); $('.answer-item:not(.ls-irrelevant) input[type="checkbox"]', thisQuestion).prop('checked', true).trigger('change'); }); </script>
<script type="text/javascript" data-author="Tony Partner"> $(document).ready(function() { var thisQuestion = $('#question{QID}'); $('input[type="checkbox"]', thisQuestion).prop('checked', false).trigger('change'); $('.answer-item:not(.ls-irrelevant) input[type="checkbox"]', thisQuestion).prop('checked', true).trigger('change'); }); </script>
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = {QID}; var thisQuestion = $('#question'+qID); var filterQuestion = thisQuestion.prevAll('.multiple-opt:eq(0)'); var filterQID = filterQuestion.attr('id').replace(/question/, ''); // Loop through irrelevant items in the filter question $('.answer-item.ls-irrelevant', filterQuestion).each(function(i) { var thisCode = $(this).attr('id').split('X'+filterQID)[1]; var arrayRow = $('input:radio[value="'+thisCode+'"]:eq(0)', thisQuestion).closest('tr'); // Hide the corresponding row in the array question arrayRow.addClass('ls-hidden'); // Un-check the radios in the corresponding row (in case of previous answers) $('input:radio', arrayRow).each(function(i) { var thisInput = $(this); thisInput.prop('checked', false); checkconditions('', thisInput.attr('name'), 'radio') }); }); }); </script>