Hi all,
I would like to create a question consisting of a multiple-short-text followed by a dropdown just like in this example
www.limesurvey.org/en/forum/design-issue...to-text-input#102550
, but simpler.
I tried to modify the survey attached to the above thread but cannot get it to work. I changed the code in the following way but now the text fields do not appear anymore. Also, in my case I would like the text fields to be in the first column and the dropdowns to be in the second. Do I just put “before” instead of “after” when trying to add a column to the array?
Code:
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>
I would highly appreciate any help!
Cheers
J