Using JavaScript to have item answers read | XM Community
Skip to main content

I want to have survey item answer options (up to four) read by a computer voice.

Does anyone know how to do that?

Another option is to have each answer option linked to an audio file, so when a user clicks on the answer option that audio is played. However, I can’t seem to do this without having a clunky button. Hence my previous question, which I think would be a different process (using JavaScript) and eliminate the button.

Thank you!

@SStrachota As far as I know, Qualtrics does not have screen reader options out-of-the-box. It only gives advice about which questions are accessible for e.g., third party screen readers. See here.

So with JavaScript, you need to store the audio file somewhere (e.g., Qualtrics library) and then add some code to the question:

Qualtrics.SurveyEngine.addOnReady(function() {
    // Create a new audio element
    var audio = new Audio('YOUR_AUDIO_URL_HERE');
    
    // Set the audio to play automatically
    audio.play().catch(function(error) {
        console.log("Audio playback failed:", error);
    });
});

This would execute the file once the question is available. If you want to make this on demand, you could implement some listeners.


Leave a Reply