Welcome to the LimeSurvey Community Forum

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

Move array question's answer options to the right of the question?

  • water1234
  • water1234's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago - 3 years 4 months ago #224877 by water1234
Please help us help you and fill where relevant:
Your LimeSurvey version: 3.27.33
Own server or LimeSurvey hosting: inria
Survey theme/template: inria
==================
By default, the answer is at the bottom of the question.
Is there a way to move the answer options of an array to the right of the question(an image)?
How can I access to the whole answer options of an array question? What is its identifier?

I attached a diagram.
 
My current code is as follows. But it doesn't work.
<div>
<div id="image" style="width:40%; float:left;">
<p style="text-align: center; background-color:white;"><img alt="" src="test-image.png" style="height: 331px; width: 500px;" /></p>
</div>

<div id="question" style="width:50%; float:right; background-color:yellow">
<p><span style="color:#000000;">To what extent do you agree or disagree with the following statement:</span></p>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
//alert("Test!");
$("#answer{SurveyID}X{QuestionGroupID}X{QuestionID}").appendTo($("#question"));
});
</script>

Thank you.
 
Last edit: 3 years 4 months ago by water1234. Reason: Delete messy code
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #224883 by tpartner
This script will apply Bootstrap class-names to float the question text and answer elements side-by-side on screens above 768 pixels wide. Below that, they revert to the vertical layout (as does the array table).

Code:
<script type="text/javascript" data-author="Tony Partner">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    var thisQuestion = $('#question{QID}');
 
    $('.question-title-container, .question-valid-container', thisQuestion).wrapAll('<div class="question-title-outer-container col-sm-6" />');
 
    $('.answer-container', thisQuestion).removeClass('col-xs-12').addClass('col-sm-6');
 
  });
</script>

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: water1234
The topic has been locked.
  • water1234
  • water1234's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #224893 by water1234
Thank you for your reply! I solved my problem.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose