Welcome, Guest
Username: Password: Remember me

TOPIC: border around 3 questions

border around 3 questions 1 year 5 months ago #92313

  • adishardis
  • adishardis's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 58
  • Karma: 0
Hi, I have a client that insists on a multiple choice question, with the choices in columns.

What I did was to divide the question into two multiple choice and float them to make them sit beside eachother and actually a third above them with description, like this:

(I added the border in the picture in photoshop to clarify what I'm after :)

border.png


Now they insist on having a border around them but I dont know how to make this. I would like a wrapping div and set border:solid 2 green, but since they are three seperate questions I'm stumped.

In this group there are questions above and depending on the choice made above there can be more questions below these three...

Any insight next couple of hours would be swell, any help to get me going in the right direction would be greatly appreciated!

Take care
Adam
The administrator has disabled public write access.

Re: border around 3 questions 1 year 5 months ago #92387

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Add the following script to the source of the first question. It will wrap it and the next question in a <div class="insertedWrapperDiv"> element.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Add a class to this and the next question
		$('#question{QID}').addClass('divWrapped');
		$('#question{QID}').nextAll('div[id^="question"]:eq(0)').addClass('divWrapped');
 
		// Wrap the two questions in a div
		$('.divWrapped').wrapAll('<div class="insertedWrapperDiv" />');
 
	});
</script>

And then add something like this to the end of template.css to style the div:
.insertedWrapperDiv {
	border: 2px solid green;
}
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: border around 3 questions 1 year 5 months ago #92388

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Sorry, I missed the bit about the third question. Use this script for 3 questions:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Add a class to this and the next 2 questions
		$('#question{QID}').addClass('divWrapped');
		$('#question{QID}').nextAll('div[id^="question"]:eq(0)').addClass('divWrapped');
		$('#question{QID}').nextAll('div[id^="question"]:eq(1)').addClass('divWrapped');
 
		// Wrap the three questions in a div
		$('.divWrapped').wrapAll('<div class="insertedWrapperDiv" />');
 
	});
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: adishardis

Re: border around 3 questions 1 year 5 months ago #92391

  • adishardis
  • adishardis's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 58
  • Karma: 0
Thanks, you're a star!! :)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.138 seconds
Donation Image