<script type="text/javascript" charset="utf-8">
$(document).ready(function(){// Identify this questionvar qID ={QID};// The sub-question codes to have no text inputvar sqCodes =[1,2,3,4];// Loop through those sq codes and remove their text inputs
$(sqCodes).each(function(i, code){
$('#question'+qID+' input[type="text"][id$="X'+qID+code+'comment"]').remove();});// The number of answers to be fixed at the end of the listvar fixedAnswers =2;// Find the number of answersvar ansCount = $('#question'+qID+' .answer-item').length;// Place the last n answers created at the end of the listvar fixedIndex = fixedAnswers -1;for(var i=0; i<fixedAnswers; i++){var answer = $('input[id^="answer"][id$="X'+qID+(ansCount-fixedIndex)+'"]');var answerItem = $(answer).closest('.answer-item');var answersList = $(answer).closest('.answers-list');if($('#question'+qID).hasClass('multiple-opt')){
answerItem = $(answer).closest('.answer-item').parent();
answersList = $(answer).closest('.subquestion-list');}if($('#question'+qID).hasClass('multiple-opt-comments')){
answersList = $(answer).closest('tbody');}
$(answersList).append(answerItem);
fixedIndex--;}});</script>