manipulate select options with jquery
<p>I'm trying to get the value and text of multiple select boxes and add them to a hidden fields, can any one please help.</p>

<pre><code>&lt;form&gt;  
 &lt;select  class="select" name="select" id="select"&gt;
            &lt;option value="0"&gt;0&lt;/option&gt;
            &lt;option value="1.99"&gt;1&lt;/option&gt;
            &lt;option value="1.99"&gt;2&lt;/option&gt;
            &lt;option value="1.99"&gt;3&lt;/option&gt;
            &lt;option value="1.99"&gt;4&lt;/option&gt;
            &lt;option value="1.99"&gt;5&lt;/option&gt;
            &lt;option value="1.99"&gt;6&lt;/option&gt;
            &lt;option value="1.99"&gt;7&lt;/option&gt;
            &lt;option value="1.99"&gt;8&lt;/option&gt;
          &lt;/select&gt;

   &lt;select class="select" name="select2" id="select2"&gt;
          &lt;option value="0"&gt;0&lt;/option&gt;
          &lt;option value="2.99"&gt;1&lt;/option&gt;
          &lt;option value="2.99"&gt;2&lt;/option&gt;
          &lt;option value="2.99"&gt;3&lt;/option&gt;
          &lt;option value="2.99"&gt;4&lt;/option&gt;
          &lt;option value="2.99"&gt;5&lt;/option&gt;
          &lt;option value="2.99"&gt;6&lt;/option&gt;
          &lt;option value="2.99"&gt;7&lt;/option&gt;
          &lt;option value="2.99"&gt;8&lt;/option&gt;
        &lt;/select&gt;

    &lt;/form&gt;

   $(function() {

//function to go through all of the select boxes and get their values based on their change state.

var qty=0;var price=0;items="";
$(".select").each(function() {

 $(this).change(function(){
  qty =($(this).text());
  price = (($(this).val()) * qty);
  items = ($(this).prevAll(".descriptionsColor").text() );
 });

});



//function to add items to shopping cart when add button is clicked.
$('#my-add-button').click(function() {

 var randomNumber = Math.floor((Math.random() * 9000)+200);
 $('input[name=my-item-id]').val(randomNumber);
 $('input[name=my-item-name]').val(items);
 $('input[name=my-item-price]').val(price);


});
</code></pre>

<p>I need to get the value and text of the select boxes on change and multiply them to get a price, also get the description of the item which is in a span tag with a class.</p>

<p>Do I need to use array variables to store the values and text and prices?</p>

<p>thanks for any help.  </p>
