Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    131
    Thanks
    5
    Thanked 0 Times in 0 Posts

    clone input to another field

    Hello,

    I have two inputs:
    <input type="text" id="field1" value="">
    <input type="text" id="field2" value="">

    As I type into field1, I want it to simultaneously show up in field2.

    how do I do that?

    Thanks!

    Tony
    ---------
    Client / Server Side Programmer II

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    <script type="text/javascript">

    Code:
    window.onload= function(){
        var field1= document.getElementById('field1');
        var field2= document.getElementById('field2');
        
        field1.onkeyup= function(){field2.value= field1.value}
    }
    </script>

  • #3
    Regular Coder
    Join Date
    Sep 2006
    Posts
    131
    Thanks
    5
    Thanked 0 Times in 0 Posts
    thank you !
    ---------
    Client / Server Side Programmer II


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •