Copy contents of one textbox to another

后端 未结 7 968
梦毁少年i
梦毁少年i 2021-02-02 00:38

Suppose an entry is made in a textbox. Is it possible to retain the same entered text in a second text box? If so, how is this done?


      
相关标签:
7条回答
  • 2021-02-02 01:28

    More efficiently it can be done as : For the one who will see the post now should use best practices of javascript.

    <script>
    function sync(textbox)
    {
      document.getElementById('n2').value = textbox.value;
    }
    </script>
    <input type="text" name="n1" id="n1" onkeyup="sync(this)">
    <input type="text" name="n2" id="n2"/>
    
    0 讨论(0)
提交回复
热议问题