Dropdowns are alternative ways to showcase single-choice questions, to use it:
- Use a single-choice question
- Copy the JS code and replace the values in the editable part to adjust to your needs
- In this case you just need to update the question code to the one question you want to use a dropdown
Dropdown JS code
// Dropdown
/*STARTS EDITABLE PART*/
let questionCode = "Q1"; //Change to current question code
/*ENDS EDITABLE PART*/
let scripts = ["https://synocdn.com/js/survey/library/dropdown.js"];
let promises = scripts.map((script) => {
return new Promise((resolve, reject) => {
document.querySelector("body").style.opacity = "0";
let s = document.createElement("script");
s.src = script;
s.onload = resolve;
s.onerror = reject;
document.head.appendChild(s);
});
});
Promise.all(promises)
.then(() => {
dropdown({
question_code: questionCode
});
document.querySelector("body").style.opacity = "1";
})
.catch((error) => {
console.error(`Failed to load script: ${error}`);
});
Copy the code above
Once you apply this to your survey you will see a result similar to the following: