JSFiddle - React, Tailwind, and code Playground
by lun471k
HTML
<table class="money">
<tbody>
<tr>
<td>
<input type="number" min="0" class="amount" value="0" /><span class="multiplier">X 50$</span>
</td>
<td><span class="result"></span>
</td>
</tr>
</tbody>
</table>
CSS
.result{
background-color:#ddd;
}
JavaScript
jQuery('.money tbody .amount').change(function(){
var amount = jQuery(this).get(0).value;
var multiplier = jQuery(this).siblings('.multiplier').text().replace(/\D*/g,'');
jQuery(this).closest('tr').find('.result').text(multiplier*amount+"$");
});
jQuery('.amount').trigger('change');