new to javascript, need some simple help

Discussion in 'JavaScript' started by redhits, Mar 6, 2008.

  1. #1
    Hello , i would like to have a page with 3 input type=text , this is easy ...

    what i need in javascript, it's that ...
    when i type in the first input type=text, the second to apper, and when i type in the second the the 3th one to apper.




    If it's possible this to be an into a while or for loop, so the script will generate even 100 input type=text if possible ...
     
    redhits, Mar 6, 2008 IP
  2. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    yeah it's fairly simple. You wouldn't want a loop though. In jQuery it would be something like:

    
    <script type="text/javascript">
        function addNewInput()
        {
            ('#inputs').append('<input type="text" onkeypress="addNewInput();" />');
        }
    </script>
    
    <div id="inputs">
        <input type="text" onkeypress="addNewInput();" />
    </div>
    
    Code (markup):
     
    lephron, Mar 7, 2008 IP