search

Home  >  Q&A  >  body text

javascript - How to separate a set of obtained data with commas in jquery?


As shown in the figure, on the right side, take the span value of the selected row of the checkbox in all li. The displayed results are connected together, such as 1234. How to separate them with commas? Open, it will display like 1, 2, 3, 4.

巴扎黑巴扎黑2748 days ago404

reply all(1)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:41:55

    It’s very simple, just split it into arrays and then join it:

    s.split("").join(",");

    reply
    0
  • Cancelreply