I am using the following example code here:
http://jsbin.com/ujuse
It uses the jQuery JavaScript Library.
How can I change it so that when you select a tick box, the comma is replaced with a new line instead? I need the text area to display:
one_name
one_name1
one_name2
Not as it does at the moment:
one_name,one_name1,one_name2
If anyone could help that would be brilliant as I have tried to download and edit the jQuery JavaScript Library myself with no success.
You can use
.join(), like this:You can test it here. What’s happening currently is since you’re passing in an array to a string property, it’s basically calling
.toString(), which has the same effect as.join(','), you can use a delimiter of your choice though, like newline in the code above.