如何计算javascript / jquery中的单价和数量变化?

I am having a small issue calculating price from Quantity in jQuery. Those are the input boxes I have.

<html>
   Quantity: <input type="text" style="width: 50px;" name="quantity" id="quantity" class="txt" value="1" />
   Unit Price: <input type="text" style="width: 50px;" name="item_price" id="item_price" class="txt" value="" />
   Amount: <input type="text" style="width: 50px;" name="total_price" id="total_price" class="txt" value="" />
</html>

Here I will show my jQuery code.Quantity ; price and Amount value also changes.jQuery Code, but unable to find the problem?

<script>
$('#quantity').click(function () {
        var number = $(this).val();
           var o_val = $("#unit_pricea").val();
           var op_val = number * o_val;
          $("#amounta").val(op_val);
          console.log(op_val);
        });
</script>

Here I will share my screen shots.

  1. First image whenever I enter unit price amount filed not fill:

First image whenever i enter unit price amount filed not fill

  1. Second image unit price can I change previous value of amount not change:

Second image unit price can i change previous value of amount not change

  1. Quantity will be change amount not changed:

Quantity will be change amount not changed

$('#unit_pricea').change(function () {
             var number = $(this).val();
                var o_val = $("#quantity").val();
                var op_val = number * o_val;
               $("#amounta").val(op_val);

Change look like this

Change your script as below.

 $("#quantity").change(function(e){
        var number = $(this).val();
        var o_val = $(this).next().val();
        var op_val = number * o_val;
        $("#amounta").val(op_val);
    });