Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
unable to set the value to the new SpeechSynthesisUtterance object

I have a function named TexttoSpeech which is called when the page is reloaded. The problem is I'm not able to set the value to msg.text using DOM. I'm able to see the text in console but not able to assign the value to msg.text . the document.getElementById("text").innerHTML is 1133 long

function TexttoSpeech() {
  var msg = new SpeechSynthesisUtterance();
  var voices = window.speechSynthesis.getVoices();
  msg.voice = voices[7];
  msg.volume = 1; // From 0 to 1
  msg.rate = 1; // From 0.1 to 10
  msg.pitch = 2; // From 0 to 2
  msg.text =  document.getElementById("text").innerHTML
  msg.lang = "es";
  window.speechSynthesis.speak(msg);

}

if (performance.navigation.type == performance.navigation.TYPE_RELOAD) {
  TexttoSpeech();
  redirectToNextPage(); //If the page reload this function is called
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!