Welcome to the LimeSurvey Community Forum

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

array number fixed

  • surveySn
  • surveySn's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 4 months ago #208930 by surveySn
array number fixed was created by surveySn
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    // The subquestion code to place in the last position
    var fixedCode = 'A8';
 
    // 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>


This script can fix a row at the end,


I want to fix 3 or 4 rows,How?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #208946 by tpartner
Replied by tpartner on topic array number fixed
Sample survey?

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 #208957 by surveySn
Replied by surveySn on topic array number fixed
I want y-scale 8, 9, 10 to be fixed at the end.

Thank you for your response,

File Attachment:

File Name: limesurvey...2546.lss
File Size:43 KB
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #208970 by tpartner
Replied by tpartner on topic array number fixed
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    // The subquestion codes to place in the last position
    var fixedCodes = ['8', '9', '10'];
 
    // Identify this question
    var q1ID = {QID};
    var thisQuestion = $('#question'+q1ID);
 
    // Move the "fixed" rows to the end
    $.each(fixedCodes, function(i, code) {
      $('table.subquestion-list tbody:last', thisQuestion).append($('tr[id$="X'+q1ID+code+'"]'));
    });
 
    // Fix up the array row background colours
    $('tr.answers-list', thisQuestion).each(function(i){
      $(this).removeClass('array1 array2').addClass('array'+(2-(i%2)));
    });
 
    });
</script>

File Attachment:

File Name: limesurvey...6(2).lss
File Size:45 KB

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 #208980 by surveySn
Replied by surveySn on topic array number fixed
Cool, thank you, Tony,
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose