Unable to use Javascript async? | XM Community
Skip to main content
Question

Unable to use Javascript async?

  • May 20, 2020
  • 1 reply
  • 72 views

Forum|alt.badge.img+1

I am trying to add custom javascript to a survey question. When I try to put the following code into the java script editor, I receive the warning "Invalid JavaScript! You cannot save until you fix all errors: Unexpected token function". Removing the "async" keyword allows me to successfully save the code. Why can't I use async?

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
async function hello() { return "Hello" };
hello();
});

1 reply

Forum|alt.badge.img+2
  • Level 2 ●●
  • May 20, 2020

Maybe because async is not supported in IE11?