JSFiddle - React, Tailwind, and code Playground
HTML
<table width="300">
<tr>
<td>Item</td>
<td>Price</td>
<td>Qty</td>
<td>Total</td>
</tr>
<tr>
<td>Adult</td>
<td id="price">5</td>
<td><input type="text" name="qty" id="qty" /></td>
<td id="total">£0.00</td>
</tr>
</table>
<input type="submit" name="submit" value="Go" id="go" />
JavaScript
$('#go').click(function() {
if($('#qty').val() != "" && !isNaN($('#qty').val())) {
var Total = parseInt($('#price').html()) * parseInt($('#qty').val());
$('#total').html("£" + Total);
} else {
alert('something is wrong');
return false;
}
});