Count the number of selected options in a Matrix table before submit

pb7pb7 Community Member Qubie ✭

Count the number of selected options in a Matrix table before submit

Hi,

I have a matrix question, with 9 statements and 2 options for each statement (they can only choose one option for each statement).

I want to hide the Next button, till they make a selection for all statements.

I have the following code and sometimes it works (when they click the left option on all 9 statements) but it does not work for other selections. Any help on how to implement this correctly?

var QID = this.questionId ;
jQuery("#" + QID + " input[type='radio']").on("click", function() {
var cnum = 0;
jQuery("#" + QID + " input[type='radio']:checked").each(function(){
cnum=cnum + 1;
		 jQuery("#"+this.questionId+" .QuestionText").append(cnum);
});
if(cnum == 9){
jQuery("#NextButton").show();
}
else
jQuery("#NextButton").hide();
});
	
Tagged:

Answers

Sign In to Comment