Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Additional Checkbox below textfield

Additional Checkbox below textfield 2 years 2 months ago #96569

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5082
  • Thank you received: 1046
  • Karma: 438
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

This message has an attachment file.
Please log in or register to see it.

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.
Last Edit: 2 years 2 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: misterdot

Additional Checkbox below textfield 2 years 2 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.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.486 seconds