Hello and welcome to our community! Is this your first visit?
Register

Results 1 to 2 of 2
  1. #1
    WTF Groupie Array
    Join Date
    Jun 2008
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I do dynamic forms using jquery?

    How do I do dynamic forms using jquery? I just want to duplicate a few inputs when a user clicks on a + button

  2. #2
    WTF Groupie Array
    Join Date
    Oct 2011
    Posts
    287
    Thanks
    0
    Thanked 1 Time in 1 Post


    here's a concept...

    HTML Code:
    <div id="fields">
    <input type="text" name="person[]" />
    </div>
    
    <input type="button" value="add a person" id="addperson" />
    
    <script type="text/javascript">
    
    $("#addperson").click(function(){
    
      $('<input>').attr({'type':'text','name':'person[]'}).appendTo($("#fields"));
    
    });
    
    </script>


 

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
  •