I am trying to dynamically populate options for my question. To change the question text, I can do something like this in the question's JavaScript:
jQuery("#"+this.questionId+" .QuestionText").html(...)
How would I do something similar to this for choice descriptions? Here is what I thought would work based on names in the Workflow tab:
jQuery("#"+this.questionId+" .ChoiceDescription/1").html(...)
Because there are thousands of possible questions and they have their respective choices, I would prefer to do this purely through JavaScript as I have a JSON object of all the data I need. But alternatives are welcome.
You need to use the correct selector. You can use your browser's inspect feature to find the correct element to update. For a PGR choice description 1 it would be:
jQuery("#"+this.questionId+" .Items li[data-choiceid=1] label>span").html(...)