- Posts: 3
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Define the filtering columns var filterColumns = [3, 4, 5]; // Identify the questions var q1 = $('#question{QID}'); var qHidden = $(q1).nextAll('.multiple-opt:eq(0)'); // Define a few vars var q1ID = $(q1).attr('id').replace(/question/, ''); var qHiddenID = $(qHidden).attr('id').replace(/question/, ''); // Hide the multiple-choice $(qHidden).hide(); // Assign some classes $('table.subquestions-list tr[id^=javatbd]', q1).each(function(i){ $('> td', this).each(function(i){ $(this).addClass('column-'+(i+1)+''); }); }); $(filterColumns).each(function(i){ $('td.column-'+this+'').addClass('filter-cell'); }); // Listener on the Q1 cells $('input.radio', q1).click(function(e) { var thisRow = $(this).closest('tr'); var thisCode = $(thisRow).attr('id').split('X'+q1ID)[1]; var hiddenInput = $('input.checkbox[id$="X'+qHiddenID+thisCode+'"]', qHidden); setTimeout(function() { if($('input.radio:checked', thisRow).closest('td').hasClass('filter-cell')) { $(hiddenInput).attr('checked', true); $(hiddenInput).nextAll('input[type="hidden"]').attr('value', 'Y'); } else { $(hiddenInput).attr('checked', false); $(hiddenInput).nextAll('input[type="hidden"]').attr('value', ''); } // Check conditions/relevance checkconditions(hiddenInput.value, hiddenInput.name, hiddenInput.type) }, 250); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} li.answer-item:visible:gt(4)').hide(); }); </script>
The jQuery selectors may be different for version 2.5. There have been some changes to the HTML in that version.Would the code be different for a newer version of LimeSurvey?