Qualtrics.SurveyEngine.addOnload(function() {
// Set the index of the choice to highlight
const highlightedChoiceIndex = 2; // Change this to the index of the choice you want to highlight (0-based index)
// Get the question container element
const questionContainer = document.getElementById('QID1'); // Replace 'QID1' with the actual question ID
// Get the choice elements within the question container
const choiceElements = questionContainer.querySelectorAll('.ChoiceStructure tbody tr');
// Loop through the choice elements
choiceElements.forEach(function(choiceElement, index) {
if (index === highlightedChoiceIndex) {
// Add a red border to the highlighted choice
choiceElement.style.border = '2px solid red';
}
});
});
In the code above, make sure to replace 'QID1'
with the actual question ID of your multiple choice question. Also, adjust the highlightedChoiceIndex
variable to the index of the choice you want to highlight (0-based index).
This code assumes that the choices in your multiple choice question are structured within a table (.ChoiceStructure
). It selects the choice element at the specified index and applies a red border to it using the style.border
property.
Remember to place this code within the appropriate location in your Qualtrics survey script, such as the JavaScript section of the question or the survey header/footer.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.