I have a multiple select box on my page. I can get the values of all the selected child options in jQuery easily like this:
$("#select").val();
That gives me an array like this:
["Hello", "Test", "Multiple Words"]
Now, I want to convert this array into a space-delimited string, but also join the individual words in each value with a dash, so that I end up with this:
"Hello Test Multiple-Words"
How would I go about doing that?
1 Answer