Hello Team,
I have configured the text to speech successfully but I am facing an issue where I would like it to not read the language selector container and if it can read the next button container. I am posting my code below if anyone can help here!
Qualtrics.SurveyEngine.addOnload(function()
{
var txtInput = document.querySelector('#Questions');
const removediv = document.querySelector('#Q_lang');
var btnSpeak = document.querySelector('#btnSpeak');
var pausebtn = document.querySelector('#pausebtn');
var resumebtn = document.querySelector('#resumebtn');
var stopbtn = document.querySelector('#stopbtn');
var NextButton = document.querySelector('#NextButton');
var BackButton = document.querySelector('#PreviousButton');
var synth = window.speechSynthesis;
var voices = [];
PopulateVoices();
if(speechSynthesis !== undefined){
speechSynthesis.onvoiceschanged = PopulateVoices;
}
//start//
btnSpeak.addEventListener('click', ()=> {
var toSpeak = new SpeechSynthesisUtterance(txtInput.textContent);
toSpeak.volume = 1;
toSpeak.pitch = 1;
toSpeak.rate = 1;
toSpeak.voice = voices[0];
synth.speak(toSpeak);
});
//pause//
pausebtn.addEventListener('click', ()=> {
synth.pause();
});
//resume//
resumebtn.addEventListener('click', ()=> {
synth.resume();
});
//stop//
stopbtn.addEventListener('click', ()=> {
synth.cancel();
});
//stop//
NextButton.addEventListener('click', ()=> {
synth.cancel();
});
//stop//
BackButton.addEventListener('click', ()=> {
synth.cancel();
});
function PopulateVoices(){
voices = synth.getVoices();
voices.forEach((item, index) => console.log(item.name, index));
}
});
Help Required! Remove and Append a div element from the text to speech
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
