JSFiddle - React, Tailwind, and code Playground
by Norlihazmey Ghazali
HTML
<table>
<tr>
<td>
<select name="nm_pot_part_shortage[]" style="width:100px;">
<option value="0">--PILIH--</option>
<?php
$query=mysql_query("SELECT * FROM mst_pot_part_shortage");
while ($nm_pot_part_shortage=mysql_fetch_array($query))
{
?>
<option value="<?php echo $nm_pot_part_shortage['nm_maker']?>">
<?php echo $nm_pot_part_shortage['nm_pot_part_shortage']?>
</option>
<?php
}
?>
</select>
</td>
<td>
<input name="nm_maker[]" id="nm_maker_2" value="" style="width:150px;" disabled>
</td>
<td>
<input type="text" name="minus_dlv[]" id="minus_dlv_2" style="width:63px;" placeholder="Minus Dlv" onkeypress="return isNumberKey(event)">
</td>
<td>
<input type="text" name="stock_ppc[]" id="stock_ppc_2" style="width:63px;" placeholder="Stock PPC" onkeypress="return isNumberKey(event)" onChange="return calculate('2');">
</td>
<td>
<input type="text" name="prod_plan[]" id="prod_plan_2" style="width:63px;" placeholder="Prod Plan" onkeypress="return isNumberKey(event)" onChange="return calculate('2');">
</td>
<td>
<input type="text" name="minus_ppc[]" id="minus_ppc_2" style="width:63px;" placeholder="Minus PPC" onkeypress="return isNumberKey(event)" readonly>
</td>
<td>
<textarea name="ls_prediction[]" id="ls_prediction_2" placeholder="Line Stop Prediction"></textarea>
</td>
<td>
<textarea name="countermeasure_ppc[]" id="countermeasure_ppc_2" placeholder="Countermeasure"></textarea>
</td>
</tr>
</table>
JavaScript
$('[name=nm_pot_part_shortage\\[\\]]').on('change', function() {
var selectVal = $(this).val();
//var selectVal = alert($( this ).val());
$(this).closest('tr').find('[name=nm_maker\\[\\]]').val(selectVal);
});