I am trying to limit the number of elements that can be placed in a bucket in a matrix likert drag & drop. I know there is the Validation option but I specifically want to make it so that it it is impossible to add another element after the limit is reached.
I saw a very similar question on StackOverflow: https://stackoverflow.com/questions/50893258/qualtrics-drag-and-drop-allowing-just-one-item-per-bucket. I have pasted the code from this question below.
Could someone explain to me how I get the IDs of the buckets? That is, what I should replace for ‘#QID8group0’ etc down below
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
jQuery(function() {
jQuery("ul.droptrue").sortable({
connectWith: "ul",
});
jQuery("ul.dropfalse").sortable({
connectWith: "ul",
dropOnEmpty: false
});
jQuery("#QID8group0,#QID8group1, #QID8group2, #QID8group3, #QID8group4, #QID8group5, #QID8group6,#QID8group7,#QID8group8,#QID8group9").disableSelection();
jQuery("#QID8group0,#QID8group1, #QID8group2, #QID8group3, #QID8group4, #QID8group5, #QID8group6,#QID8group7,#QID8group8,#QID8group9").on("sortreceive", function(event, ui) {
var jQuerylist = jQuery(this);
if (jQuerylist.children().length > 1) {
jQuery(ui.sender).sortable('cancel');
}
});
});
});