Multiple Choice Button to Play Hidden Audio | Experience Community
Skip to main content
Question

Multiple Choice Button to Play Hidden Audio

  • Apr 20, 2023 6:16 PM UTC
  • 3 replies
  • 148 views

Forum|alt.badge.img+3

hello, 

 

I would like to have a multiple-choice option play a hidden audio file. Does anyone know how to do that? I know how to hide the audio but don’t know how to have the selection of the choice trigger the audio to play. 

 

Thank you! 

3 replies

Forum|alt.badge.img+15
  • QPN Level 4 ●●●●
  • Apr 20, 2023 10:24 PM UTC

Hi @AnnaM89 ,

 

I think you can refer to this video link on how to hide and play around with audio file. 

Instead of Image click, just change the javascript code to “label” or “id” on which you want to play audio.

Hope this helps.

 

Thanks,

JB   


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • Apr 21, 2023 1:37 PM UTC

Thank you for this! Having a click on an image to trigger would be fine. However, I am getting an error with the code suggested in the video: 

 

Qualtrics.SurveyEngine.addOnload(function()
{
    
});

Qualtrics.SurveyEngine.addOnReady(function(){
    
    jQuery(".img").on('click',function)(){
        
        jQuery('audio').trigger("play");
        
    });
    
});

Qualtrics.SurveyEngine.addOnUnload(function()
                                   {
    
});

 

Can you see anything wrong with it? Sorry - I am not very familiar with javascritpt. 

 

Thanks again! 


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • Apr 24, 2023 6:16 PM UTC

Hello again, 

 

I was able to get this working. However, when I have multiple audio files - it plays all of them. How can I specify it to only play one per image? 

 

Thanks!