Reputation: 61
I have a price calculator on my website. I would like jquery to pick the value on one box and send it to the other box in real time.
<form>
How much do you want to spend <input type="text" id="pricein" /><br />
This is how much you will spend<input type="text" id="priceout"/>
</form>
anybody know how this can be accomplished with jquery? This sounds like it might be easy but I'm learning it all slow but I'm learning. Thanks!
Upvotes: 2
Views: 172
Reputation: 2705
use keyup
$('#pricein').bind('keyup', function()
{
$('#priceout').val($(this).val());
});
Upvotes: 1
Reputation: 20481
$("#pricein").keyup(function() {
$("#priceout").val($("#pricein").val());
});
Upvotes: 7
Reputation: 2591
You need the val()
function:
var price = $('#pricein').val()
and to set the value:
$('#priceout').val(newValue);
You can read the documentation here
Upvotes: 1