Legacy
Max answers for a checkbox
Advanced guide to capping the number of selectable options on a checkbox question in a form using a custom JavaScript snippet.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var jq = $.noConflict();
jq(document).on('change', 'input[name^="query_2004686"]', function (e) {
if (jq('input[name^="query_2004686"]:checked').length > 3) {
jq(this).prop('checked', false);
alert("Only 3 Checked Answers Allowed");
}
});
jq(document).on('change', 'input[name^="query_2005423"]', function (e) {
if (jq('input[name^="query_2005423"]:checked').length > 2) {
jq(this).prop('checked', false);
alert("Only 2 Checked Answers Allowed");
}
});
</script>Step by step
Last updated
Was this helpful?

