treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Append new textfield via JS

  • Hey guys!

    I'm kind of stuck in a JS-Problem.

    The goal
    I'm trying to achieve a behavior like it's found in the reminders web-app (iCloud) by Apple. What it does is, that if you fill a textfield (at least one character), it will automatically append a new one below. So you can add tasks "on the fly".
    I tried to do it exactly that way, but it turned out my JS knowledge is too shitty :)

    I hope someone could help me out here. I made a pen with the basic layout.

    Check out this Pen!



    Thanks!

  • This should get you started.

    http://codepen.io/andyunleashed/pen/FJwCh

    I've basically set it so on keyup in the input it adds another text field. Still needs a lot of work though.

  • Hey!

    Thanks for your help!
    Is there any possibility to "refresh" the JS? I tried to achieve the behavior, that if the second textfield is filled a third one should appear, and if the third one is filled a fourth one appears, and so on. Do you have any idea how to achieve this?