- Posts: 14194
- Thank you received: 4329
Ask the community, share ideas, and connect with other LimeSurvey users!
$('#question{QID} tr[id^="javatbd"]:eq(0) .radio-item:eq(2) *').remove();
<style> .answer_cell_3 label::before { display:none; } </style>
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var fixedAnswerCode = '4'; // Das ist der Code von "Keine davon" var thisQuestion = $('#question{QID}'); // Index the array columns $('table.subquestion-list tr', thisQuestion).each(function(i) { $('> *', this).each(function(i) { $(this).attr('data-index', i); }); }); // Identify the fixed column var fixedIndex = $('.answer_cell_'+fixedAnswerCode+':eq(0)').attr('data-index'); $('[data-index="'+fixedIndex+'"]', thisQuestion).addClass('fixed-column'); // Identify "no answer" if($('.noanswer-item', thisQuestion).length > 0) { $('table.subquestion-list tr > :last-child', thisQuestion).addClass('col-no-answer'); } // Create an array of the columns var columns = []; $('table.subquestion-list tr.answers-list:eq(0) td.answer-item', thisQuestion).each(function(i) { columns.push($(this).attr('data-index')); }); // A function to shuffle elements or contents of arrays (function($){ $.fn.shuffle = function() { return this.each(function(){ var items = $(this).children(); return (items.length) ? $(this).html($.shuffle(items)) : this; }); } $.shuffle = function(arr) { for( var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x ); return arr; } })(jQuery); // Shuffle the columns array columns = $.shuffle(columns); // Reposition the row elements $('table.subquestion-list tr', thisQuestion).each(function(i) { var thisRow = $(this); $(columns).each(function(i, val) { thisRow.append($('[data-index="'+val+'"]', thisRow)); thisRow.append($('.fixed-column', thisRow)); thisRow.append($('.col-no-answer', thisRow)); }); }); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.