"See more" button | XM Community
Skip to main content

How can I include a "see more" button in my question, where the respondent can click on the button and display more details about the question?

There’s instructions here for that: 

 


@Vsolbiati Add this html to your question source

<style type="text/css">#hidden-paragraph {
display: none;
}
</style>
<p>The short part of the question <span id="hidden-paragraph">The hidden part that will be revealed when you click see more button....................ble bla bla</span></p>
<button id="see-more-button">See more...</button>

Add this to Javascript to activate the button

Qualtrics.SurveyEngine.addOnReady(function() {
document.getElementById("see-more-button").addEventListener("click", function() {
var hiddenParagraph = document.getElementById("hidden-paragraph");
if (hiddenParagraph.style.display === "none") {
hiddenParagraph.style.display = "inline";
this.textContent = "See less...";
} else {
hiddenParagraph.style.display = "none";
this.textContent = "See more...";
}
});
});

Hope this helps


@Vsolbiati Add this html to your question source

<style type="text/css">#hidden-paragraph {
display: none;
}
</style>
<p>The short part of the question <span id="hidden-paragraph">The hidden part that will be revealed when you click see more button....................ble bla bla</span></p>
<button id="see-more-button">See more...</button>

Add this to Javascript to activate the button

Qualtrics.SurveyEngine.addOnReady(function() {
document.getElementById("see-more-button").addEventListener("click", function() {
var hiddenParagraph = document.getElementById("hidden-paragraph");
if (hiddenParagraph.style.display === "none") {
hiddenParagraph.style.display = "inline";
this.textContent = "See less...";
} else {
hiddenParagraph.style.display = "none";
this.textContent = "See more...";
}
});
});

Hope this helps

Many thanks!! Can I use this code for more than one question or do I need to change it?


@Vsolbiati Add this html to your question source

<style type="text/css">#hidden-paragraph {
display: none;
}
</style>
<p>The short part of the question <span id="hidden-paragraph">The hidden part that will be revealed when you click see more button....................ble bla bla</span></p>
<button id="see-more-button">See more...</button>

Add this to Javascript to activate the button

Qualtrics.SurveyEngine.addOnReady(function() {
document.getElementById("see-more-button").addEventListener("click", function() {
var hiddenParagraph = document.getElementById("hidden-paragraph");
if (hiddenParagraph.style.display === "none") {
hiddenParagraph.style.display = "inline";
this.textContent = "See less...";
} else {
hiddenParagraph.style.display = "none";
this.textContent = "See more...";
}
});
});

Hope this helps

Many thanks!! Can I use this code for more than one question or do I need to change it?

If you showing muliple question on the same page, just throw down number behind the variable and id. Like hidden-paragraph1, hidden-paragraph2, see-more-button 1 to distinguish them.


Leave a Reply