Check out the LimeSurvey source code on GitHub!

How to insert a number beside the points

More
5 years 9 months ago - 5 years 9 months ago #59198 by guislopes
Hello folks.
I need to insert a number beside each answer point on the 'array' question type, I already tried limesurvey options but I got nothing more than a headache. Please, someone could help me? I would be very very thankful. :)
The figure explains better what I am trying to.








Thank you!!
Attachments:
Last Edit: 5 years 9 months ago by guislopes. Reason: the picture is not showing up still

Please Log in to join the conversation.

More
5 years 9 months ago - 5 years 9 months ago #59212 by tpartner
Set up your survey to use JavaScript and place the following script in the source of the array question. Replace "QQ" with the array questtion ID.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		// The array question ID
		var qID = QQ;
 
		// Insert a number beside each radio button
		$('#question'+qID+' table.question tbody').each(function(){
			$('td', this).each(function(i){
				$('<span>'+(i+1)+'</span>').appendTo(this);
			});
		});
 
	});
 
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 9 months ago by tpartner.
The following user(s) said Thank You: guislopes

Please Log in to join the conversation.

More
5 years 9 months ago #59218 by guislopes
Hello Tony,

It worked great! THANK YOU VERY MUCH TONY! :laugh:

One more thing, if it is possible, how could I change the font and size of the numbers?

Please Log in to join the conversation.

More
5 years 9 months ago - 5 years 9 months ago #59220 by tpartner
Something like this at the end of template.css (replace"QQ"):
#questionQQ  table.question tbody span {
	font-size: 1.3em;
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
	color: #0000FF;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 9 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 9 months ago #59228 by guislopes
Hi Tony,

I did what you said but it did not work. To see if I did it correctly, the following picture is what I did. What may be happened?




Thank you very much for the help!

Guilherme
Attachments:

Please Log in to join the conversation.

More
5 years 9 months ago #59229 by tpartner
That looks okay if the ID is correct. Did you clear your cache?

T.

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: guislopes

Please Log in to join the conversation.

More
5 years 9 months ago #59231 by guislopes
Hi Tony,

You are right. I was a dummy :whistle:
My question is solved.

Thank you very very much! :woohoo:

Please Log in to join the conversation.

More
5 years 9 months ago #59232 by tpartner
:laugh:

Cheers,
Tony Partner

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

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form