Welcome to the LimeSurvey Community Forum

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

Partially Randomized Answers - Array questions

  • surveySn
  • surveySn's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 4 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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #208770 by tpartner
Replied by tpartner on topic Partially Randomized Answers - Array questions
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.
  • surveySn
  • surveySn's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 4 months ago #208772 by surveySn
Replied by surveySn on topic Partially Randomized Answers - Array questions
Perfect,

Thank you, Tony,
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose