JSFiddle - React, Tailwind, and code Playground
by thillin
HTML
<input class="bounty"></input>
<div class="listing">Listing Fee: £30</div>
<div class="bounty">Bounty: £<span></span></div>
<div class="total">Total: £<span></span></div>
JavaScript
var price_cost = 30;
$('.plan').click(function() {
var c_item = $(this).attr("id");
price_cost = parseInt(c_item, 10);
$('div.plan_cost span').remove();
$('div.plan_cost').append('<span>' + price_cost + '</span>');
});
$("input.bounty").change(function(){
bounty = $('input.bounty').val();
$('div.bounty span').remove();
$('div.bounty').append('<span>' + bounty + '</span>');
$('div.total span').remove();
var total = price_cost + parseInt(bounty, 10);
$('div.total').append('<span>' + total + '</span>');
});