将值分配到3个下拉列表中


Distributing Value into 3 Dropdown

所以我有一个输入值的赋值,但是有一个限制,所以当用户不能超过给定的一定限制时。问题是,我不知道如何将数字分配到三个输入标记中,以便这三个输入的总和不会超过限制,而且还必须是实时的。

<?php
while ($row = oci_fetch_array($result, OCI_BOTH)){
$qtyAvailable = $row['QTY_REQUIRED'] - $row['QTY_CNCED'];   
       echo '<input class="form-control" name="quantityToCutCnc" type="number" min="0" max='.$qtyAvailable.' placeholder="CNC">';
       echo '<input class="form-control" name="quantityToCutScator" type="number" min="0" max='.$qtyAvailable.' placeholder="Scator">';
       echo '<input class="form-control" name="quantityToCutManual" type="number" min="0" max='.$qtyAvailable.' placeholder="Manual">';

}?>

假设$qtyAvailable为10,当用户将第一个输入滑动到10时,他们无法实时地增加输入2和3的数字。

提前感谢你们的帮助:)

jQuery.data( document.body, "selector", number );

$( "#yourinputselector" ).bind( "click", function() {
//get data + quantity analysis
alert( "You have x amount left" ); //or something of the like
});

看到这个

你应该能够使用类似的东西来对quantity进行评估onclick