Reputation: 129
Hi guys i have such select element:
<select name='files'>
<option value='1'>logo.jpg</option>
<option value='2'>file.ex</option>
</select>
i would like to have an array of the items like this:
files=logo.jpg,file.ex (i want the text not the values!)
thank you.
Upvotes: 0
Views: 31
Reputation: 150010
var files = $('select[name="files"]').find("option").map(function() {
return $(this).text();
}).get();
Further reading:
Upvotes: 2