2

Please help me. I need to change a textbox value when i give value in another textbox. see i have three text box first one is Qty another Amount and third will be a Total Amount. here i will give a value for Qty and amount. Now third textbox i mean Total amount will be appear automatically.

Please help me...

3 Answers 3

1

You use the change event to monitor your first two inputs. Then you use the val method to get and set the property values.

http://jsfiddle.net/8hunC/

$('#qty, #amount').change( function(){
    var total = $('#qty').val() * $('#amount').val();
    $('#total').val(total);
});
Sign up to request clarification or add additional context in comments.

Comments

0

HTML5 has an oninput event that would serve this purpose. You'd need to use events like onfocus, onkeypress and onblur in conjunction to achieve a similar level of responsiveness in older browsers, though. Or, if it's not essential that these values be updated with every keystroke, you can simply use the onchange event to update the value whenever the user changes, then blurs the textbox.

Comments

0

Here's a quick example: http://jsfiddle.net/adeneo/xMjdR/3/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.