Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Additional Checkbox below textfield

Additional Checkbox below textfield 3 years 4 months ago #96569

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6417
  • Thank you received: 1434
  • Karma: 558
Here is an updated script that hides the check-box question and moves the check-box and label into the numeric question.

This script also makes the numeric input and check-box exclusive.

<script type="text/javascript" charset="utf-8">	
		// Identify the questions
		var q1ID = '{QID}';
		var q1 = $('#question'+q1ID+'');
		var q2 = $(q1).nextAll('.multiple-opt:eq(0)'); 
		var q2ID = $(q2).attr('id').split('question')[1];
		// Hide Q2
			'position': 'absolute',
			'left': '-9999em'
		// Move the checkbox and label to Q1
		$('.answer-item', q1).after($('.checkbox-list', q2));
		// Some cleanup styles
		$('.checkbox-list', q1).css({
			'margin-left': $('.answer-item', q1).css('margin-left'),
			'list-style': 'none'
		// Listener on the numeric input
		$('input[type="text"]', q1).keyup(function(){
			if($(this).val() != '') {
				$('input.checkbox', q1).attr('checked', false);
		// Listener on the checkbox
		$('input.checkbox', q1).change(function(){
			if($(this).attr('checked') == true) {
				$('input[type="text"]', q1).val('');

Here is the survey back with the updated script in the source of the numeric question:

File Attachment:

File Name: limesurvey...8832.lss
File Size:15 KB
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 4 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: misterdot

Additional Checkbox below textfield 3 years 4 months ago #96575

  • misterdot
  • misterdot's Avatar
  • Offline
  • Junior Lime
  • Posts: 39
  • Thank you received: 1
  • Karma: 0
Works beautifully - thanks so much!
The administrator has disabled public write access.
Time to create page: 0.269 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form