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

How to separate Selected Choices if one of the choice text contains a comma?

  • January 25, 2023
  • 2 replies
  • 68 views

Forum|alt.badge.img+6

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?


    2 replies

    rondev
    Level 6 ●●●●●●
    Forum|alt.badge.img+22
    • Level 6 ●●●●●●
    • January 30, 2023

    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.


    TomG
    Level 8 ●●●●●●●●
    Forum|alt.badge.img+27
    • Level 8 ●●●●●●●●
    • January 30, 2023

    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