开发者

jquery mutiple text field update in form

开发者 https://www.devze.com 2023-04-08 05:24 出处:网络
i 开发者_如何学JAVAneed to create a html form where upon entering value on one input text field should automatically enter calculated value in another input text field using jquery.I found a source ht

i 开发者_如何学JAVAneed to create a html form where upon entering value on one input text field should automatically enter calculated value in another input text field using jquery.I found a source http://pastie.org/2607417,where i have input text value which output in a paragraph... Any help would be greatly appreciated


$("input[name='textbox1']").blur(function() {
//if u want to perform any calculation
   var textbox2val=.....;
//if u want to just paste the textbox1 value
   var textbox2val=$(this).val();
$("input[name='textbox2']").val(textbox2val);
});


Try

<input type="text" value="" id="text1" />
<p></p>
<div></div>
<script>
    $("#text1").keyup(function () {
      var value = $(this).val();
      value2 = value*2;
      value3 = value*3.7;
      $("p").text(value2);
       $("#text2").val(value3);
    });
</script>
<input type="text"  value="" id="text2" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号