- Posts: 8
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // Assign column-specific attributes and classnames $('tr.subquestion-list', thisQuestion).each(function(i) { $('> *', this).each(function(i) { $(this).attr('data-column', i); }); }); $('tr.subquestion-list:last td.answer-item', thisQuestion).addClass('exclusive-item'); // A function to un-check boxes function resetCheckbox(thisItem) { $(':hidden', thisItem).val(''); $(':checkbox', thisItem).prop('checked', false).trigger('change'); } // Listener on the checkboxes $(':checkbox', thisQuestion).on('change', function(e) { if($(this).is(':checked')) { var thisItem = $(this).closest('.answer-item'); var thisColumn = $(thisItem).attr('data-column'); var items = $('td.answer-item[data-column="'+thisColumn+'"].exclusive-item', thisQuestion); if($(thisItem).hasClass('exclusive-item')) { items = $('td.answer-item[data-column="'+thisColumn+'"]:not(.exclusive-item)', thisQuestion); } $.each(items, function(i, el) { resetCheckbox(el); }); } }); // The subquestion code to place in the last position var fixedCode = 'A8'; // Move the "fixed" row to the end $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+qID+fixedCode+'"]')); // Fix up the array row background colours $('tr.answers-list', thisQuestion).each(function(i){ $(this).removeClass('array1 array2').addClass('array'+(2-(i%2))); }); }); </script>
Please Log in to join the conversation.
... // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); // The subquestion code to place in the last position var fixedCode = 'Y010'; // Move the "fixed" row to the end $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+qID+fixedCode+'"]')); // Assign column-specific attributes and classnames ...
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
// The subquestion code to place in the last and in second to last position var [b]fixedCode1 [/b]= 'Ysecond2lastRow'; var [b]fixedCode2[/b] = 'YlastRow'; // Move the "fixed" row to the second to the last position $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+qID+[b]fixedCode1[/b]+'"]')); // The subquestion code to place in the last position // Move the "fixed" row to the end $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+qID+[b]fixedCode2[/b]+'"]'));
Please Log in to join the conversation.