I would like to pass values from multiple dropdown menus to a modal. The dropdowns are created in a foreach loop, and the number of dropdowns varies depending on how many products are on a specific order.
Here is one of the dropdown menus:
<select name="status_update_7873" class="confirm-options">
<option value="2" selected="selected"></option>
<option value="3">Shipped</option>
<option value="4">Out of Stock</option>
<option value="0">Cancel Item</option>
</select>
The user can select an option for this product, and all other products on an order. To make sure that product statuses are correct and the user submits all relevant updates in one click/post we use a modal that confirms the user's choices. The modal shows the product names and the status update option selected from the dropdowns on the page.
I am not sure how to get the status updates to show for each product. The below passes the value of the first dropdown only. I would like the selected option from each dropdown to show for the related product.
$('.status_update_btn').click(function(){
$('#status_update').modal('show');
$('.confirm-options').each(function(){
$('.modal-body .status').text($(".confirm-options").val());
});
});
Here is a jsfiddle (modal replaced by alert): http://jsfiddle.net/9m3xs/5/
Thank you