If it helps, here is some similar code used to fix answer options to bottom of a list:
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>
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:complete',function() {
// Define the subquestion code to be fixed at the top of the array
var fixedCode = '1';
// Move that row to the top
$('#question{QID} table.subquestion-list tbody:eq(0)').prepend($('tr[id$="X{QID}'+fixedCode+'"]'));
// Fix up the row background colours
$('#question{QID} tr').each(function(i){
$(this).removeClass('array1, array2');
if(i % 2 == 0) {
$(this).addClass('array1');
}
else {
$(this).addClass('array2');
}
});
});
</script>
Here's your survey back with that script included in the question text.