如何根据在另一个文本框中输入的值更新一个文本框中的值?
问题描述:
如何根据在另一个文本框中输入/更改的值更新一个文本框中的值( txtInterest%
)( txtAmt
)?
How do I update the value in one text box (txtInterest%
) based on the value entered/changed in another text box (txtAmt
)?
答
使用jQuery的更改更新方法。使用你的例子:
Use jQuery's change method for updating. Using your example:
$('#txtAmt').change(function() {
//get txtAmt value
var txtAmtval = $('#txtAmt').val();
//change txtInterest% value
$('#txtInterest%').val(txtAmtval);
});