How to place a certain option at the end of a list with randomized answers at Limesurvey survey

Randomizing answer items is an often used approach at scientific surveys and market research. At Limesurvey this can easily be done. Just go to the advanced question settings of a certain question and then set “Random order” to “Randomize on each page load“.
But often such a list contains an option like “Don’t know” or “None of these” or similar. Such an option may appear in the middle of the list of answers if they are randomized and that looks confusing to the user.

In order to place a certain answer item at the bottom of a randomized list, add the following JavaScript code at your question text, using the source code mode of the editor:

Source code mode:
Source code mode of integrated Limesurvey editor

Code:

<script type='text/javascript'> 
/* Place option 5 at the end of the randomized list */
$(document).ready(function() {
var move_element="5";
/* Please do NOT change the lines below */
var move_element="javatbd{SGQ}"+move_element;
$("#"+move_element).insertAfter("#question{QID} .answers-list .answer-item:last-child");
}); 
</script>

This script snippet will move answer item 5 to the end of the randomized list. “5” is the answer code of the to be moved item.

You want to re-order the “other” option? No problem, we have explained this at How to re-order the “other” option at a Limesurvey survey.