in

Input SUM depend on selectbox jquery


In the light of the code below, I want the return type to have a separate total and if the male will be the result of the total male input. In the meantime, the whole Total is going to Sales Total. Below are 2 roads as an example. There will be many more rows like this, each of which will have a type of sales / return. The following two inputs will fill up accordingly.

<script> 
$(document).on("change", ".track", function() {
    var sum = 0;
    $(".track").each(function(){
        sum += +$(this).val();
    });
    $(".total").val(sum);
});
    
</script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>

     

        <select name="type[]">
            <option value="male"> Male</option>
            <option value="female"> Female</option>
          </select>
         
          <input type="text" name="amount[]" class="track" value="" /> <br>
          
          
          
    <select name="type[]">
            <option value="female"> Female</option>
            <option value="male"> Male</option>
          
          </select>
         
          <input type="text" name="amount[]" class="track" value="" /> <br>
          
          
                <select name="type[]">
            <option value="male"> Male</option>
            <option value="female"> Female</option>
          </select>
         
          <input type="text" name="amount[]" class="track" value="" /> <br>
          
          
          
          
 <hr> 
    <label> Male Total: </label>
    <input type="text" class="total" value="" />
    
        <label> Female Total: </label>
    <input type="text" class="total" value="" />
    



Source: https://stackoverflow.com/questions/70627501/input-sum-depend-on-selectbox-jquery

Quarkus reactive rest client @HeaderParam("Authorization") not working and how to debug

Browser-based ETH vanity address generator with vue.js