vendredi 19 août 2016

JavaScript/jQuery checkbox logic based on certain conditions

Here is my scenario Three dynamic variables "count" and "text" and "condition" 5 rows of checkboxes with "text" values as yes and no. For eg: condition =yes, count =3, Condition is yes, so at least one check box with "yes" has to be selected, count is 3 so maximum 3 can be selected satisfying the above yes condition.

Consider yes and no as checbox Possibilities: 1.yes,no,no= no problem yes is checked first 2.no,yes,no=no problem yes is checked second 3.no,no,yes= problem, because the first two checked as no, so we should disable the checkbox with no values, forcing the user to select "yes" checkbox 4. If they selected yes and reached the maximum count 3 remaining checkbox should be disabled 5.another scenario, what if the count has value 1 and condition yes, they should select only the checkbox with yes value the remaining should be disabled in onload.

Please give a logic with explanation




Aucun commentaire:

Enregistrer un commentaire