I have the following javascript code:
$(':input').bind('keypress keydown keyup change',function(){
var BetAmount1 = parseFloat($(':input[name="BetAmount"]').val(),10);
var v = '';
if (!isNaN(BetAmount1)){
v = BetAmount1 * 10;
}
$(':input[name="PotentialGain"]').val(v.toString());
});
I have the following two inputs being echoed through PHP:
<input class="defaultText" type="text" name="BetAmount" id="BetAmount">
<input type="text" name="PotentialGain" id="PotentialGain" />
When the user inputs or changes a BetAmount, I would like to instantly show a calculated PotentialGain, which, for example, can be found by multiplying a constant by the specified bet amount entered in by the user.
Thanks for your time and consideration.
This?
Live demo: http://jsfiddle.net/Rj64t/