- Posts: 1
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
arrayNumbers: <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify the questions var thisQuestion = $('#question{QID}'); var nextMultiText1 = $(thisQuestion).nextAll('.multiple-short-txt:eq(0)'); // Hide the next questions $(nextMultiText1).hide(); // Add extra columns to the array $('table.question thead tr th:eq(1)', thisQuestion).after('<th class="newColumn1" />'); $('table.question tbody tr', thisQuestion).each(function(i) { $('td:eq(1)', this).after('<td class="newColumn1" />'); }); // Move the hidden question text to the inserted columns $('table.question thead tr th.newColumn1', thisQuestion).text($('.questiontext', nextMultiText1).text()); // Move the text inputs and dropdowns $('input.text', nextMultiText1).each(function(i){ $('table.question tbody tr:eq('+i+') td.newColumn1', 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>
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify the questions var thisQuestion = $('#question{QID}'); var nextMultiText1 = $(thisQuestion).nextAll('.multiple-short-txt:eq(0)'); // Hide the next questions $(nextMultiText1).hide(); // Add a column to the array (before answer column 1) $('table.question thead tr th:eq(0)', thisQuestion).before('<th class="newColumn1" />'); $('table.question tbody tr', thisQuestion).each(function(i) { $('td:eq(0)', this).before('<td class="newColumn1" />'); }); // Move the hidden question text to the inserted column $('table.question thead tr th.newColumn1', thisQuestion).text($('.questiontext', nextMultiText1).text()); // Move the text inputs $('input.text', nextMultiText1).each(function(i){ $('table.question tbody tr:eq('+i+') td.newColumn1', 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>