Highlight Question and Loop and Merge | XM Community
Skip to main content

Hi all,
Really need help with adjusting JS code for incorporating sentences from loop and merge to the "edit this highlight text" part of the highlight question.
Cannot find a way to make it work.
Thanks for the help!

Use this:
Qualtrics.SurveyEngine.addOnload(function () {
var words = "${lm://Field/1}".split(" ");
jQuery("#"+this.questionId+" .HLTextWord").each(function(i) {
if(i < words.length) jQuery(this).text(words[i]);
else jQuery(this).hide();
});
});


Thank you so much for your response TomG, but for some reason it still does not work.
I used your code for the JS code part of a question, and the question is inside the block that has Loop and Merge, also with Field 1 as a column of desired sentences.
And here is what I see in the preview:
text of the question is there, but the sentence to highlight is not reflected.
Screen Shot 2022-09-26 at 15.29.55.png


https://community.qualtrics.com/XMcommunity/discussion/comment/49987#Comment_49987Have you set up your highlight text with the maximum number of words in your field1 sentences? For example, if your longest sentence is 5 words, your highlight text should be something like: word1 word2 word3 word4 word5


Thanks a million TomG!!! That was the issue, now it works!!


Leave a Reply