Dynamically changing text in a text question depending on the choices in a previous hot spot question | XM Community
Skip to main content

Hi!
I need. help in setting logics in one of my surveys.

I am trying to write a Java Script code that. would enable me to dynamically change text in a text question depending on the choices in a previous hot spot question. Could anyone help me how such a code would look like?

Put the text you want to change inside a html element with a class:

<span class="changeThis">text to change dynamically</span>

Then dynamically change it with JS:

var changeThis = jQuery("#"+this.questionId+" .changeThis");
if("{piped text}"=="x") changeThis.html("new text if x")
else if("{piped text}"=="y") changeThis.html("new text if y");

 


Leave a Reply