How to synchronize two text box form values?

前端 未结 6 725
旧时难觅i
旧时难觅i 2021-02-05 04:56

Hi all i am new to jQuery. Suppose I have two HTML text boxes. How can I make it happen that if I write in text box A then same value goes to textbox B and if I write in B then

6条回答
  •  爱一瞬间的悲伤
    2021-02-05 05:19

    This is quite easy:

    $("#textBoxA").keyup(function(){
       $("#textBoxB").val($("#textBoxA").val());
    });
    
    $("#textBoxB").keyup(function(){
       $("#textBoxA").val($("#textBoxB").val());
    });
    

提交回复
热议问题