I have a Side-by-side question that I’ve written JavaScript for (the first column has a checkbox that disables the rest of the row if checked). This works fine on a desktop browser, but doesn’t seem to run at all on a mobile device (tested on iOS and Android). When I connect to web inspector (iOS) I don’t see that the script is called at all (no errors, no console output). I’m not sure what to check next.
Please help, you’re my only hope!
Qualtrics.SurveyEngine.addOnload(function()
{
var choices = document.querySelectorAll(".Choice");
this.questionclick = function (event, el) {
const disableChoice = function (choiceTD) {
choiceTD.children[0].disable();
choiceTD.children[1].style.background = "lightgrey";
choiceTD.children[1].style.borderColor = "lightgrey";
choiceTD.children[1].style.opacity = "25%";
}
const enableChoice = function(choiceTD) {
choiceTD.children[0].enable();
choiceTD.children[1].style.background = "";
choiceTD.children[1].style.borderColor = "";
choiceTD.children[1].style.opacity = "";
}
console.log('clicked', {event, el});
c_el = el.id.split("#")[1].split("~");
if (c_el[0] == 1) {
if (c_el[2] == 1) {
const action = jQuery("input[id='"+el.id+"']").prop('checked') ? disableChoice : enableChoice;
choices[c_el[1] - 1].querySelectorAll(".SBS2").forEach(element => action(element));
choices[c_el[1] - 1].querySelectorAll(".SBS3").forEach(element => action(element));
choices[c_el[1] - 1].querySelectorAll(".SBS4").forEach(element => action(element));
}
}
};
});