- Posts: 88
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
var questionContainer = $('#question{QID}'); // Find all the checkboxes within the question container var checkboxes = questionContainer.find('input[type="checkbox"]'); // Filter out the fixed checkboxes (2 and 5) and store their values var fixedCheckboxes = ; checkboxes.each(function() { var checkbox = $(this); var checkboxValue = parseInt(checkbox.val()); if (checkboxValue === 2 || checkboxValue === 5) { fixedCheckboxes.push(checkbox); } }); // Remove the fixed checkboxes from the list checkboxes = checkboxes.not(fixedCheckboxes); // Shuffle the remaining checkboxes checkboxes.sort(function() { return Math.random() - 0.5; }); // Insert the fixed checkboxes at their respective positions questionContainer.find('input[type="checkbox"]').slice(0, 0).before(fixedCheckboxes[0]); questionContainer.find('input[type="checkbox"]').slice(3, 3).before(fixedCheckboxes[1]);
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.