- 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(){ // Identify the questions var thisQuestion = $('#question{QID}'); var nextMultiText = $(thisQuestion).nextAll('.multiple-short-txt:eq(0)'); var nextArrayFlexi = $(thisQuestion).nextAll('.array-flexible-row:eq(0)'); // Hide the next questions $(nextMultiText).hide(); $(nextArrayFlexi).hide(); // Add extra columns to the visible array $('table.question thead tr', thisQuestion).append('<th class="newColumn1" /><th class="newColumn2" />'); $('table.question tbody tr', thisQuestion).append('<td class="newColumn1" /><td class="newColumn2" />'); // Move the hidden question text to the inserted columns $('table.question thead tr th.newColumn1', thisQuestion).text($('.questiontext', nextMultiText).text()); $('table.question thead tr th.newColumn2', thisQuestion).text($('.questiontext', nextArrayFlexi).text()); // Move the hidden text inputs and dropdowns $('input.text', nextMultiText).each(function(i){ $('table.question tbody tr:eq('+i+') td.newColumn1', thisQuestion).append(this); }); $('select', nextArrayFlexi).each(function(i){ $('table.question tbody tr:eq('+i+') td.newColumn2', thisQuestion).append(this); }); // Some cleanup styles (for the default template) $('col', thisQuestion).css({ 'width': 'auto' }); $('table.question tbody th, table.question tbody td', thisQuestion).css({ 'padding': '4px 10px' }); }); </script>