How to separate Selected Choices if one of the choice text contains a comma? | XM Community
Skip to main content

I used this code to split the selected choices from a previous question.
var bullets = jQuery("#"+this.questionId+" .bullets"); var ul = bullets.hide().after("

    ").next(); jQuery.each(bullets.html().split(", "), function(i,val) { ul.append("
  • "+val+"
  • "); });});
    It worked, but one of the choice text has a comma, so it split that choice text into 2. How can I fix it?


    This might be a time consuming task/ method. We can use branch logic to determine if a particular choice was selected and create a ul html tag in an embedded data.


    In your choice with the comma, add a zero width space after the comma.
    Before:
    This is the choice, text
    After:
    This is the choice,​ text


    Leave a Reply