Welcome to the LimeSurvey Community Forum

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

"Exclusive option" in array

More
6 years 1 week ago #187949 by tpartner
This will make all columns except the last exclusive:

Code:
<script type="text/javascript" charset="utf-8">
 
$(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify this question
    var qID = {QID};
 
    // Answers are exclusive by column (except last column)
    $('#question'+qID+' td:not(:last-child) input[type="radio"]').click(function(event){
      var thisAnsCode = $(this).attr('id').split('-')[1];
      $('#question'+qID+' input[id$="-'+thisAnsCode+'"]').prop('checked', false);
      $(this).prop('checked', true);
    });
  });
</script>

Here is your sample survey back with that script:

File Attachment:

File Name: limesurvey...5171.lss
File Size:31.89 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: EnricoCaruso
The topic has been locked.
More
6 years 1 week ago #187950 by EnricoCaruso
Thank you, it works great!
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose