...maybe a little easier to read and adjust (also a little more efficient):
Code:
<script type="text/javascript" data-author="Tony Partner">
$(document).on('ready pjax:scriptcomplete',function(){
var thisQuestion = $('#question{QID}');
var prevQuestion = thisQuestion.prev('.question-container');
// Define the excluded options
var excludes = {
'1': [4, 5, 6, 7, 8, 9],
'2': [1, 2, 3, 7, 8, 9],
'3': [1, 2, 3, 4, 5, 6]
}
$('.answer-item :radio', prevQuestion).on('click', function(i) {
// Reset the drop-down
$('select.form-control').val('').trigger('change');
$("select.form-control option", thisQuestion).show();
// Get value of previous question
var selectedValue = $(this).val();
// Hide answer options based on selectedValue
$.each(excludes[selectedValue], function(i, val) {
$('select.form-control option', thisQuestion).filter(function () { return $(this).val() == val; }).hide()
});
});
});
</script>