Set a limit on multi-select options
Use custom javascript to limit users to their top e.g. 5 options
// Set max checkbox limit
$(function () {
var maxCheckboxes = 5;
var checkboxes = $('.checkbox-group[data-question-slug="QUESTION_SLUG"] .form-checkbox');
checkboxes.on('change', function (evt) {
var checkedCheckboxes = checkboxes.filter(":checked");
if (checkedCheckboxes.length > maxCheckboxes) {
this.checked = false;
alert("Please select a maximum of " + maxCheckboxes + " options.");
}
});
});Last updated