Welcome, Guest
Username: Password: Remember me

TOPIC: how to mix two dropdown list together in one box

how to mix two dropdown list together in one box 2 years 8 months ago #90000

  • mimi
  • mimi's Avatar
  • Offline
  • Junior Lime
  • Posts: 32
  • Karma: 0
<script type="text/javascript">

$(document).ready(function () {

$("#td_for_G2_Q0014").attr("width","30%"); //make column 1 width 30%
$("#td_for_G2_Q0014_input ul").attr("style", "list-style:none outside none"); //make checkbox into horizontal line
$("#td_for_G2_Q0014_input li").attr("style", "float:left; margin-left:10px"); //"

$("#td_after_G2_Q0014").html($("#td_for_G2_Q0015").html()); //copy from next question
$("#question98").remove();

// Identify the questions
var thisQuestion = $('#question{QID}');
var nextQuestion = $(thisQuestion).next('div[id^="question"]');

// Hide the next question
$(nextQuestion).hide();

// Move the radios from the next question
$('.answer .answer-item', thisQuestion).append($('ul.answers-list', nextQuestion));

// Some cleanup styles
$('.answer-item select, .answer-item ul, .answer-item li', thisQuestion).css({
'float': 'left'
});
$('.answer-item ul', thisQuestion).css({
'list-style': 'none',
'margin-left': '50px'
});
$('.answer-item li', thisQuestion).css({
'margin-right': '15px'
});
});



</script>



the code above is if we want to mix drpdown list and 5 point choice together in one box.
but how can we mix drpdown list with another drpdown list in one box?
which part from the code can i change.

TQ~
Last Edit: 2 years 8 months ago by mimi.
The administrator has disabled public write access.

how to mix two dropdown list together in one box 2 years 8 months ago #90008

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5082
  • Thank you received: 1046
  • Karma: 438
I'm not sure what the first 5 or 6 lines are supposed to do but the pertinent code would be:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
 
		// Identify the questions
		var thisQuestion = $('#question{QID}');
		var nextQuestion = $(thisQuestion).next('div[id^="question"]');
 
		// Hide the next question
		$(nextQuestion).hide();
 
		// Move the select (dropdown) from the next question
		$('.answer .answer-item', thisQuestion).append($('.answer .answer-item select', nextQuestion));
 
		// Some cleanup styles
		$('.answer-item select', thisQuestion).css({
			'float': 'left',
			'margin': '0 25px 10px 0'
		});
	});
</script>

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

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.
Last Edit: 2 years 8 months ago by tpartner.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.129 seconds