<select multiple="multiple" class="listBox" name="drop1" id="toList">
<option value="1">John Doe (1)</option>
<option value="2">John Doe (2)</option>
<option value="3">John Doe (3)</option>
<option value="4">John Doe (4)</option>
<option value="5">John Doe (5)</option>
</select>
I am trying to be able to grab every single option in this toList and build out a delimited list that I will then post to another page.
What is the most efficient way of doing this?
I thought of originally doing:
$(#toList).each(function () {
var myList = myList + $(this).val();
});
$.post('somepage.asp', userList: myList);
What is the best way to accomplish this?
This should work nicely:
Or if you only want the selected values: