SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast VKX's Avatar
    Join Date
    Oct 2005
    Location
    Chicago
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make input 1 = input 2

    I'm terrible with javascript, so please forgive my question in advance.

    I have a form. I want the user to type something into input 1, and for the something to appear (in real time) in input 2. What would that javascript look like?

    I would normally just google a script this simple, but I'm having difficulty explaining it in a search-friendly phrase.

    Thanks!
    AwesomeStart.com - Free customizable start pages!

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2009
    Location
    Bavaria, Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please dive into the techniques you're using :-) and try something like this (untested):

    HTML Code:
    <input id="input1" name="input1" value="" onkeyup="copyit()" />
    <input id="input2" name="input2" value="" />
    <script type="javascript/text">
    function copyit(){
    document.getElementById("input2").value=document.getElementById("input1").value;
    }
    </script>

  3. #3
    SitePoint Enthusiast VKX's Avatar
    Join Date
    Oct 2005
    Location
    Chicago
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's not quite working. I need to make it so that as I type something in input 1, it appears in input 2.

    I actually couldn't get that script to do anything at all
    AwesomeStart.com - Free customizable start pages!

  4. #4
    SitePoint Zealot
    Join Date
    Aug 2009
    Location
    Bavaria, Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I cannot see your script I do not know what is not working... I think it'll be much more easy to help you if you provide some code or link or at least the JS error message while using the FF extensions Web Developer or Firebug or something similar.


Bookmarks

Posting Permissions

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