Welcome to the LimeSurvey Community Forum

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

Show answer codes

  • Oterito
  • Oterito's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 day 8 hours ago #271103 by Oterito
Show answer codes was created by Oterito
Please help us help you and fill where relevant:
LimeSurvey version: 6.15.4
Own server or LimeSurvey Cloud: Limesurvey Cloud
Survey theme/template: Fruity
==================

Hi! I would like to do answer codes visible on a survey. 
I tried this but it didn't work: forums.limesurvey.org/forum/can-i-do-thi...swer-codes-in-survey
I found some code but it uses "imput value" which in radio butom its ok but in multiple options question appears "Y - ":

document.addEventListener("DOMContentLoaded", function () {
  document.querySelectorAll('.answer-item').forEach(function (item) {
    const input = item.querySelector('input');
    const label = item.querySelector('label');
    if (input && label) {
      const code = input.value;
      const text = label.textContent.trim();
      label.textContent = `${code} - ${text}`;
    }
  });
});

Do you know some javascript that i can copy to custom.js and works for all type of question? Or some javascript i can use for multiple option questions? 

Thanks in advance. 

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose