Hi All,
I have added a Pick, Group and Rank type question in my survey but the choices to select from are huge. Is there a way using Javascript where I can add a search bar on the pick box to filter out the choices?
Hi All,
I have added a Pick, Group and Rank type question in my survey but the choices to select from are huge. Is there a way using Javascript where I can add a search bar on the pick box to filter out the choices?
Best answer by Deepak
Will something like below work for you, add it to the pick, group, rank question.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
jQuery('.Items h2').append(' <input type="text" id="search-box" placeholder="Search...">');
var items = jQuery('.itemsContainerTd li')
jQuery('#search-box').on('input', function() {
var searchTerm = jQuery(this).val();
jQuery(items).each(function() {
const text = jQuery(this).text().toLowerCase();
if (text.includes(searchTerm)) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
});
});Hope it helps!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.