title: jQuery Multiply two values on drop down select
body: <p>Hi I have a bit of code which once you select drop value the price field updates </p>
  
  <p>3 or more selected from drop down price = £10.99 each 2 price = £11.99 each 1 price = £12.99 each</p>
  
  <pre><code>jQuery(document).ready( function(){
  
          var map = [ '12.99', '11.99', '10.99' ];
  
          jQuery('#payslips-required').change(function(){
  
              var o = parseInt($(this).val()) &lt; 3 ? jQuery(this).val()-1 : 2;
  
              jQuery('#price').val(map[o]).addClass('hidden');
  
          });
  
      });
  </code></pre>
  
  <p>Currently the above works but when I add a total field right next to it and amend the jQuery to work out the total, price x number selected</p>
  
  <p>Here is the example in action <a href="http://jsfiddle.net/U92fq/1/" rel="nofollow">http://jsfiddle.net/U92fq/1/</a> which works </p>
  
  <p>but when I place the added code which is </p>
  
  <pre><code>var price = $('#price').val()   
              var quantity = $('#payslips-required').val()    
              var total = price * quantity;
              jQuery('#total').val(total).addClass('hidden');
  </code></pre>
  
  <p>Into into the original code does not work when it clearly does on the jsfiddle link provided both the price and total do not display. </p>
  
  <p>Just can't see why it does not work. </p>
  
  <p>Summary: Need to get the total to work. </p>
  
  <p>Note: using this on Wordpress with Contact form 7 plugin can be seen here <a href="http://payslips4u.co.uk/order-monthly-payslips/" rel="nofollow">http://payslips4u.co.uk/order-monthly-payslips/</a> </p>