Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Partially Randomized Answers - Array questions

More
4 years 8 months ago #208765 by surveySn
Version 3.22.11 + 200330

I use this:
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    // The subquestion code to place in the last position
    var fixedCode = 'A1';
 
    // Identify this question
    var q1ID = {QID};
    var thisQuestion = $('#question'+q1ID);
 
    // Move the "fixed" row to the end
    $('table.subquestion-list tbody', thisQuestion).append($('tr[id$="X'+q1ID+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>

But there is a problem
Each loop title has a fixed answer.
The topic has been locked.
More
4 years 8 months ago #208770 by tpartner
Change this:

Code:
$('table.subquestion-list tbody', thisQuestion).append($('tr[id$="X'+q1ID+fixedCode+'"]'));

To this:

Code:
$('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+q1ID+fixedCode+'"]'));

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
4 years 8 months ago #208772 by surveySn
Perfect,

Thank you, Tony,
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose