I am not sure why this isn't working, but I have some JS to add text before, after, and below a text entry field. I need it to change when the survey language is changed, when I switch to the Spanish version, the text controlled by JS stays the same (stays as the ELSE version below). What am I doing wrong with the code below? Apologies as I am not trained in JS, I'm sure it's something small but I'm currently stumped.
Qualtrics.SurveyEngine.addOnReady(function()
{
if( "${e://Field/Q_Language}" =="es") //Check which language is selected
{
let all_inputs = this.getQuestionContainer().querySelectorAll("input");
var a = "
Ninguno, ingrese 88
No sé/No estoy seguro, ingrese 77"
jQuery(a).insertAfter("#"+this.questionId+" .InputText");
all_inputs[0].insertAdjacentText("afterend"," (1-30)");
all_inputs[0].insertAdjacentText("beforebegin","Número de días: ");
}
else
{
let all_inputs = this.getQuestionContainer().querySelectorAll("input");
var a = "
For None, enter 88
For Don’t know/not sure, enter 77"
jQuery(a).insertAfter("#"+this.questionId+" .InputText");
all_inputs[0].insertAdjacentText("afterend"," (1-30)");
all_inputs[0].insertAdjacentText("beforebegin","Number of days: ");
}
});
