Welcome to the LimeSurvey Community Forum

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

Add text to array buttons

  • honorem
  • honorem's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 10 months ago #136903 by honorem
Add text to array buttons was created by honorem
Suppose I am using an array question, is it possible to add text next to the buttons inside the array "table"? This will mean I have the usual y- and x-scale but adding a third scale, z, which is inside but next to each button in the array table? Included a .png for further information..
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago #136912 by tpartner
Replied by tpartner on topic Add text to array buttons
You will need to insert those with JavaScript. LimeSurvey version?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • honorem
  • honorem's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 10 months ago #136914 by honorem
Replied by honorem on topic Add text to array buttons
Ah, I see, Im using 2.06+ with a default template with minor modifications..
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago - 7 years 10 months ago #136922 by tpartner
Replied by tpartner on topic Add text to array buttons
Set up your survey to use JavaScript and add something like this to the question source:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function() {  
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Assign row and column specific classes
    $('table.subquestions-list tr.answers-list', thisQuestion).each(function(i) {
      $(this).addClass('row-'+(i+1)+'');
      $('> *', this).each(function(i){
        $(this).addClass('column-'+i+'');
      });
    });
 
    // Insert text/images
    $('.row-1 .column-1 .radio', thisQuestion).after('<br  />Inserted text 1...');
    $('.row-2 .column-3 .radio', thisQuestion).after('<br  /><img src="https://www.limesurvey.org/images/template/logo.jpg" />');
    $('.row-3 .column-4 .radio', thisQuestion).after('<br  />Inserted text 2...');
  });
</script>


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 10 months ago by tpartner.
The topic has been locked.
More
7 years 10 months ago #136979 by Deusdeorum
Replied by Deusdeorum on topic Add text to array buttons
Really nice answer as always, works great!

If I'm understanding right .after() will place the text/image after the css button, is it possible to, with the same jquery place text/image left of, right of and before the buttons by just changing .after()? I lack jquery knowledge really..
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 10 months ago #137009 by tpartner
Replied by tpartner on topic Add text to array buttons

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • honorem
  • honorem's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 10 months ago #137193 by honorem
Replied by honorem on topic Add text to array buttons
Thank you tpartner, works nice!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose