I have a Javascript string array with values like A12, B50, C105 etc. and I want to turn it into a pipe delimited string like this: A12|B50|C105...
How could I do this? I'm using jQuery (in case that helps with some kind of builtin function).
I have a Javascript string array with values like A12, B50, C105 etc. and I want to turn it into a pipe delimited string like this: A12|B50|C105... How could I do this? I'm using jQuery (in case that helps with some kind of builtin function). |
|||
|
|
|||
|
No need for
|
||||
|
Use JavaScript ' Hope this helps. |
|||
|
For a native JavaScript array then On the other hand, if you are using jQuery and the return value is a jQuery wrapped array then you could do something like the following (untested):
See this article for more information. |
|||
|
var checked = $(':input[type="checkbox"]:checked').map(function(){return this.value}).get(); console.log(checked.join(", ")); |
|||
|
Find complete example |
|||
|