I need to create such an array in jQuery:
one,two,three,four
selecting text from several <span> children:
<div id="GROUP"> <div><input value="somevalue"/><span>one</span></div> <div><input value="somevalue"/><span>two</span></div> <div><input value="somevalue"/><span>three</span></div> <div><input value="somevalue"/><span>four</span></div> </div>
I tried with this:
$('html').find('#GROUP span').text();
But it combines the entire text without spaces:
onetwothreefour
I need to separate the text with commas
Thanks so much for your generous help :)
Working demo
jquery text
user3746998
source share