Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
930 views
in Technique[技术] by (71.8m points)

javascript - How to update the value in one text box based on the value entered in another text box?

How do I update the value in one text box (txtInterest%) based on the value entered/changed in another text box (txtAmt)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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);
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...