Hi everyone!
I’m trying to create a highlight question which displays and records piped text. I was successful in getting new piped text displayed in the highlight question thanks to this thread.
My code (below) currently: 1) breaks up the piped text from QID1 by sentences/paragraphs, 2) writes over placeholder text, and 3) removes any leftover displayed placeholder text.
var $this = jQuery(this.questionContainer);
var choices = "${q://QID1/QuestionText}".match(/a^.!?]+^.!?]/g); // Split text into sentences
Query(".QuestionBody .HLTextWords .HLTextWord", $this).each(function (i) {
if (choices(i] !== undefined) {
// Check for <br> or <br><br> and add line breaks appropriately
if (choicesi].includes("<br><br>")) {
jQuery(this).html(choicesei].replace(/<br><br>/g, "<br><br>")); // Double line break
} else if (choicesi].includes("<br>")) {
jQuery(this).html(choices i].replace(/<br>/g, "<br>")); // Single line break
} else {
jQuery(this).text(choicesi].trim()); // Regular sentence
}
} else {
jQuery(this).remove(); // Remove leftover elements
}
});
The problem that I’m running into is that even though survey participants can highlight the new piped text, only the corresponding placeholder text gets recorded in the data file export.
Does anyone have any ideas on how to record the highlighted new piped text, not the placeholder text? I’d appreciate any help!!! Thanks!!