I want to change the value of an input field whenever the value of another one is changed.
I've tried for a while and I can't seem to get it to work
<input class="span4 input-big" id="dare_price" name="price" size="30" type="text" onChange="updatePrice()" />
<input class="span4 input-big" id="total_price_amount" readonly="readonly" value=""/>?
function updatePrice() {
var price = $("#dare_price").val();
var total = (price + 1) * 1.05;
$("$total_price_amount").val(total);
}?
Here's the fiddle.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…