How to add audio into a slider? | XM Community
Skip to main content
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).
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).
@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);



});
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!
Hello @Irene ,



Please find the attached QSF and for survey link click here
Hello @Irene ,



Please follow this post
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.
Thanks @Shashi ! Where do I insert the HTML of the audio?
> @Irene said:

> Thanks @Shashi ! Where do I insert the HTML of the audio?



Go to question Rich content editor -> "<>" source view

Leave a Reply