Question T151
Visible to All Users

How to uncheck options based on other checked option in the same group

created 7 years ago

Hi guys, is there a way that in a question type: "checkbox" to uncheck all the options except the one that trigger the uncheck functionality, for example: I have 5 options in a checkbox group but one of them if checked trigger that the rest of the options must be unchecked, is a little bit confusing but I hope you get the idea, right now I try to accomplish this via jQuery ( I leave the fragment of code below), but since I realized that the checkboxes are not rendering like a normal checkbox I can't apply this method, could you please give me some ideas ASAP!!! Thanks

*I attached an image to illustrate the idea!

$("#surveyElement").on('change','#sq_140',function(e) {

currentVal = e.target.value;

if (currentVal == 'ninguna de las anteriores'){
$('#sq_140').not(this).attr('checked', false);
}

});

Answers

created 7 years ago

Hello,
Are you looking for something like this: https://plnkr.co/edit/hSO3td?p=preview?

Thank you,
Andrew

    Comments (1)

      Thanks Bro! works like a charm