Welcome to the LimeSurvey Community Forum

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

One answer option for two / three answer codes

  • NielsFro
  • NielsFro's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 6 months ago #159400 by NielsFro
Hi all,

I hope this question has not been asked multiple times before, but I was not able to find anything in the forum or the workarounds...

I have a survey with answer options from 1 to 7 and a No answer

With the normal LS features, I can add text to each of the answer options and right now I have

1 = below the expectations
4 = fulfils the expecations
7 = above the expecations

however, I would like to have
1 & 2 = below the expectations
3 & 4 & 5 = fulfils the expectations
6 & 7 = above the expectations

in a way that centers the text above 1&2 / 3&4&5 / 6&7

I hope I was able to make my question clear - if not, please let me know and I can put a graphic together in PowerPoint or Paint ... :D

thanks a lot!
Niels
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago - 6 years 6 months ago #159406 by tpartner
Replied by tpartner on topic One answer option for two / three answer codes
Placing a script like this in the question source will manipulate the column labels as described on desktop devices:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:complete',function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Label for columns 6-7 (column-7 label spans 2 columns)
    $('thead th:eq(7)', thisQuestion).prop('colspan', 2).prev().remove();
 
    // Label for columns 3-5 (column-4 label spans 3 columns)
    $('thead th:eq(4)', thisQuestion).prop('colspan', 3).next().remove();
    $('thead th:eq(4)', thisQuestion).prev().remove();
 
    // Label for columns 1-2 (column-1 label spans 2 columns)
    $('thead th:eq(1)', thisQuestion).prop('colspan', 2).next().remove();
  });
</script>


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 6 months ago by tpartner.
The topic has been locked.
  • NielsFro
  • NielsFro's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 1 month ago #164846 by NielsFro
Replied by NielsFro on topic One answer option for two / three answer codes
Dear Tony, I completely forgot to thank you for your effort and to let you (and everyone who's interested) know, that this worked out perfectly! Thanks a lot
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose