Hi, as the title says I'm looking to fix a variable number of answer options at the bottom of a list. The idea is basically to have a random order list, with options such as "Don't know" and "None of these" fixed at the bottom.
I used workaround code that enabled me to do this in the past, however trying to use it on my current installation doesn't appear to work.
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// The number of answers to be fixed at the end of the list
var fixedAnswers = 2;
// Identify this question
var qID = {QID};
// Find the number of answers
var ansCount = $('#question'+qID+' li.answer-item').length;
// Place the last n answers created at the end of the list
var fixedIndex = fixedAnswers - 1;
for (var i=0; i<fixedAnswers; i++) {
var answer = $( 'input[id$="X'+qID+(ansCount-fixedIndex)+'"]');
var answerItem = $(answer).closest('li');
var answersList = $(answer).closest('ul');
$(answersList).append(answerItem);
fixedIndex--;
}
});
</script>
Server is set up to use Javascript and if I attempt to use a different workaround then it works fine.
Hello. I tried using the code above to accomplish this, but it didn't work. My question type is multiple choice, with an exclusive option "None of the above" that is automatically anchored. This question also contains an "Other" option that I'd like to anchor at the bottom of the list. A screenshot is attached.
LimeSurvey version: Version 4.2.6+200602
Question type: Multiple choice (M)
Question code: G02Q02
"Other" value: 15
"None of the above" value: 16
This code thread is about anchoring answer options, not sub-questions. Please start a new topic and include a sample survey (.lss file) containing only one question.
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.