Skip to content Skip to sidebar Skip to footer

Why I Am Not Getting Total Value Correctly After Changing In Item Name?

I am new in Javascript. I have created an invoice table where the total value in the last column is calculated by selecting item price with putting the value in quantity field. The

Solution 1:

After several tries to find the solution, Finally I got the answer:

 <script>
     function myItemPrice(){
           var price = $('#selected_item').find(':selected').data('price');
           $('#getprice').val(price);
           var getprice = document.getElementsByName('getprice')[0].value;
          var qty = document.getElementsByName('qty')[0].value;
          var total;
         total = parseFloat(getprice) * parseFloat(qty);
          document.getElementsByName('total')[0].value = total;
        }
    </script>

Post a Comment for "Why I Am Not Getting Total Value Correctly After Changing In Item Name?"