Auto populate

Discussion in 'JavaScript' started by sbronson, Dec 4, 2009.

  1. #1
    I wasn't sure what thread to put this in so I went here. If I have 3 text fields. When I type something in the first text field how do I auto fill the last 2 with the same entry and still have control over the last 2 fields. Can anyone help me with the code?
     
    sbronson, Dec 4, 2009 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    following might help..

    
    <html>
    </head>
    <script type="text/javascript">
    function doOnKeyUp(obj)
    {
    	document.getElementById('txt2').value = obj.value;
    	document.getElementById('txt3').value = obj.value;
    }
    </script>
    </head>
    
    <body>
    
    <input type="text" name="txt1" id="txt1" onkeyup="doOnKeyUp(this);" value="" />
    <input type="text" name="txt2" id="txt2" value="" />
    <input type="text" name="txt3" id="txt3" value="" />
    
    </body>
    </html>
    
    Code (markup):
     
    mastermunj, Dec 5, 2009 IP
  3. sbronson

    sbronson Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the help,, I really appreciate it!
     
    sbronson, Dec 6, 2009 IP