add radio button

More
1 month 3 days ago #185603 by benshuo
add radio button was created by benshuo
hi, everyone, I'm working on one discrete choice and designing the table below. As you can see, the radio button dose not be displayed in "Visualization B" column. I don't know how to solve it. I'd appreciate you can help me to fix it. Thanks
Attachments:

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
1 month 3 days ago #185607 by tpartner
Replied by tpartner on topic add radio button
Can you attach a small sample survey (.lss file) containing only that question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago #185613 by benshuo
Replied by benshuo on topic add radio button
Thanks for the reply so quickly. Please find the attachment below, I make a simple one.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago #185622 by tpartner
Replied by tpartner on topic add radio button
You need the script to be this:

<script type="text/javascript" charset="utf-8">
 
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Move the radios
		$('.question-text table:eq(0) tr:last td:eq(1)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion));
		$('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion));
		$('.question-text table:eq(0) tr:last td:eq(3)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(2) *', thisQuestion));
 
		// Some classes for presentation
		$('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio');
		$('.question-text table:eq(0) .radio-item label', thisQuestion).show();
 
		// Click event on the table cells
		$('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) {
			$('input:radio', this).trigger('click');
		});
		$('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) {
			e.stopPropagation();
		});
 
		// Clean-up styles
		$('.answer-container', thisQuestion).hide();
		$('.question-text table:eq(0) .label-text', thisQuestion).remove();
		$('.question-text table:eq(0) .radio-text', thisQuestion).css({
			'cursor': 'pointer'
		});
		$('td.radio', thisQuestion).css({
			'display': 'table-cell',
			'padding': '5px'
		});
    });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...8451.lss
File Size:21 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #185671 by benshuo
Replied by benshuo on topic add radio button
Thanks for the help. It works on my project.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!