how to add a form with a unique id on jquery?

Javascript: Add textboxes dynamicly to form with label?

  • I want to do something like this: <html> <head> <script> var id = 2; function add_phone_field() { for (i=0;i<=5;i++){ var obj = document.getElementById("phone"); var data = obj.innerHTML; data += "<input type='text' name='person_phone[]' id='person_phone"+id+"' /> "; obj.innerHTML = data; id++; } } </script> </head> <body> <form method="post" action="" enctype="multipart/form-data"> <table width="800" border="0" dir="rtl" style="direction:ltr;"> <tr> <td style="direction:rtl;"><label for="label2" >phone</label> <span style="color:#00f;font-size:20px;font-we… onclick="add_phone_field()">[+]</span> <div id="phone" align="right"> <input type="text" name="person_phone[]" id="person_phone1" /> </div></td> </tr> <tr> <td><label for="label4"></label> <div align="right"></div></td> </tr> <tr> <td colspan="2"><p align="right"> <input name="add" type="submit" id="add" value="add" /> </p></td> </tr> </table> </form> </body> </html> Except that I want each textbox field created with a label on top or next to the text box

  • Answer:

    Something similar here:

Alex at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.