Skip to content
Loading
  1. $(document).ready(function() {  
  2.     $("#products select").on("change", function() {  
  3.         var id =this.value;  
  4.         alert(this.value)  
  5.          if(this.value != '')  
  6.          {  
  7.          //initialize totalPrice to 0 if doesn't contain a value  
  8.          var totalPrice = $("#totalprice").val() !== "" ? parseInt($("#totalprice").val()): 0;  
  9.            totalPrice = totalPrice +  parseInt(this.value)  
  10.             $("#totalprice").val(totalPrice);  
  11.                     }  
  12.            
  13.     });  
  14. });  
 
+1