How to set the limit of selected choices? | XM Community
Skip to main content
I use javascript to set a Multiple Answer question. I set that subjects can only select 5 choices. When they select 5 choices, the unselected choices will be disabled. When I preview the questionnaire, I find that the code works in the browser view, but it fails to work in the mobile phone view. What's wrong with it?

How can I solve this problem?

Thanks a lot.



Here is the code I used:

> this.questionclick = function(event,element){

> var selectedchoice=this.getSelectedChoices();

> if(selectedchoice.length==3){

> jQuery("#"+ this.questionId +" input:checkbox:not(:checked)" ).attr("disabled", true);

> }else{

> jQuery("#"+ this.questionId +" input:checkbox:not(:checked)" ).attr("disabled", false);

> };

> };
Hi @cqulihui,

I'd recommend to try your code using a real phone first. It once happened to me that something wasn't working in the preview mode, but it worked fine in the "real" questionnaire.

Leave a Reply