Dear Qualtrics community,
Does anyone know how to add audio into a slider in Qualtrics? I would like to add several sounds to different levels in a slider, such that participants can adjust the slider and hear different sounds (and locate their answer based on the sounds).
Page 1 / 1
Hi!
Does anyone know how to add audio into a slider in Qualtrics? I would like to add several sounds to different levels in a slider, such that participants can adjust the slider and hear different sounds (and locate their answer based on the sounds).
Does anyone know how to add audio into a slider in Qualtrics? I would like to add several sounds to different levels in a slider, such that participants can adjust the slider and hear different sounds (and locate their answer based on the sounds).
@Irene Take a look at this post. I'm assuming you know how to load your audio files and get them to play using Javascript at the very least.
Hi @Irene ,
what about something like this?
Qualtrics.SurveyEngine.addOnload(function()
{
// the id of the question for referencing the value
var q_id = this.questionId;
var x = document.getElementById("myAudio"); //Get the HTML audio element which is defind in the question body
var val;
window.setInterval(function(){ //Execute function again and again after a very short certain time period
val = $(q_id+'~1~toolTipBox').innerHTML; //Value of the slider
if( val > 20 && val < 30) {x.play();} //Star playing when value is between 20 and 30
}, 50);
});
what about something like this?
Qualtrics.SurveyEngine.addOnload(function()
{
// the id of the question for referencing the value
var q_id = this.questionId;
var x = document.getElementById("myAudio"); //Get the HTML audio element which is defind in the question body
var val;
window.setInterval(function(){ //Execute function again and again after a very short certain time period
val = $(q_id+'~1~toolTipBox').innerHTML; //Value of the slider
if( val > 20 && val < 30) {x.play();} //Star playing when value is between 20 and 30
}, 50);
});
Thank you @fleb !
I tried to replace "myAudio" with the HTML of the audio I want it to play, but it says invalid javascript. What more do I need to replace/include? I am very new at Qualtrics..
Thank you so much for helping out!
I tried to replace "myAudio" with the HTML of the audio I want it to play, but it says invalid javascript. What more do I need to replace/include? I am very new at Qualtrics..
Thank you so much for helping out!
Hi @Irene,
the HTML code must be in the body of the question, not in the script. Use "HMTL View to insert it". ID of the audio element must be "myAudio" unless you modify the script.
the HTML code must be in the body of the question, not in the script. Use "HMTL View to insert it". ID of the audio element must be "myAudio" unless you modify the script.
Thanks @Shashi ! Where do I insert the HTML of the audio?
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.