I have some code that will set the answer of the second scale for a hard coded subquestion, but how would I expand this to automatically set this answer depending on which subquestion is clicked? The second scale automatic answer ("None") should only be applied if the first answer is clicked in the first scale ("Never"). The following screenshot illustrates this better than I can describe in words:
I am using LS 3.14
My code:
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Loop through first-row answers
$('tr.answers-list:eq(0) input[type="radio"]', thisQuestion).each(function(i) {
// Click the fourth column
if(i == 4) {
var thisName = $(this).attr('name');
if($('input[type="radio"][name="'+thisName+'"]:checked', thisQuestion).length == 0) {
$(this).trigger('click');
}
}
});
});
</script>
I have attached a survey with a sample question. You can see that the question has two scales: one for frequency and one for intensity:
It is clear that if the user selects "never" for Frequency, the answers "a little", "a lot", "extreme" for Intensity make no sense. That is why I would like to automatically select "none" for Intensity if the user selects "never" on the Frequency scale.
I have some code in there, but it is not dynamically selecting "never" if the user selects "none" for a subquestion.