I have an Array(Numbers) question type that asks the respondent to identify the number of people in their household for each age range listed. There are 11 age ranges in the y-axis. The x-axis lists 0..5 in a dropdown list to choose from.
I need this question to be mandatory, but obviously, not every age range is in every household. As a result, I needed to set the default value for each y-axis item to 0 and select the drop down. Then the respondent can set the appropriate values where needed.
Here's the code I added to set this default.
Code:
<script type="text/javascript">
$(document).ready(function(){
for( var i=1; i<12; i++ ){
$("#answer111133X316X6454age" + i + "_nbr1 option[value='0']").prop('selected', true);
}
});
</script>
Is this the right approach to solving this? Or did I miss something in the question setup?
Thanks for looking.