- Posts: 21
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Add text to array buttons
- honorem
- Topic Author
- Offline
- Junior Member
Less
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 10 months ago #136912
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
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
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 10 months ago - 7 years 10 months ago #136922
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
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.
Attachments:
Last edit: 7 years 10 months ago by tpartner.
The topic has been locked.
- Deusdeorum
- Offline
- Senior Member
Less
More
- Posts: 72
- Thank you received: 17
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..
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 10 months ago #137009
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Add text to array buttons
Yes -
api.jquery.com/before/
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
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
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.