Hello everyone,
I'm figuring out how to process entered digits as one number.
For now, I'm only able to process the input with the last entered, single digit.
Is there a way to store the entered digits to a string, and then make that string a number again?
Or maybe something more sufficient?
Code:
$("input.input-amount").live("keypress", function (e) {
if (e.keyCode >= 48 && e.keyCode <= 57) {
var amount = String.fromCharCode(e.keyCode);
$(this).val(amount);
var price = $(this).parent().next().find("input.input-price").val();
var total = amount * price;
$(this).parent().next().next().find("input").val(total);
}
});
Thank you.