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
Related Q & A:
- How to uninstall Firefox add-on using javascript?Best solution by Stack Overflow
- How do I add custom attributes to javascript tags in Wordpress?Best solution by WordPress
- How Can I add Latitude, Longitude dynamically in Javascript?Best solution by Stack Overflow
- how to change the position of item inside the listview dynamicly in android?Best solution by Stack Overflow
- What is the strongest form of ADD medication?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.