can we put count on dynamic selection in the same question of graphic options selection question?
Now, I want the participant to be able to see the count of items they are selecting out of 20 dynamically. meaning, if I select one item, the count should be 1; if I select 3 items count should be 3. This count should display in the same question as the person keeps selecting; the count should change.
Qualtrics.SurveyEngine.addOnload(function() {
var q = jQuery("#" + this.questionId);
var limit = 10;
// Add counter display
q.find(".QuestionText").after("<div class='selectionCount' style='margin-top:10px; font-weight:bold; color:#007ac0;'>Selected: 0/" + limit + "</div>");
var display = q.find(".selectionCount");
// All checkboxes in this question
var checkboxes = q.find("inputitype='checkbox']");
// Count function
function updateSelectionCount() {
var count = checkboxes.filter(":checked").length;
display.text("Selected: " + count + "/" + limit);
}
// Attach listener
checkboxes.on("change", function () {
updateSelectionCount();
});
// Run once in case there's pre-selected options
updateSelectionCount();
});
This is how it will look like. You can change the styling of the text according to your need.

Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.