aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes dynamic input field generation within the same page at defined location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "dynamic input field generation within the same page at defined location" Watch "dynamic input field generation within the same page at defined location" New topic
Author

dynamic input field generation within the same page at defined location

Ackshat Sharma
Greenhorn

Joined: Sep 03, 2011
Posts: 22
on writing a document.getElementById("id").innerHTML='<input type=\"number\" />';

inside a loop in a javascript function replaces every previous input box by the new one, so no matter the loop prints it n times but it is displayed only once i.e the last printed field

and document.writeln('<input type...>') in the loop prints n fields in a new basic display.

Can anyone here tell me how to dynamically display input fields within the same page at any desired location


Thanks.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 507
Hello,
You need to concat the "'<input type=\"number\" />' " to existing innerHTML.
Hence it should be

innerHTML = innerHTML + new input field.


Regards,
Amit
Ackshat Sharma
Greenhorn

Joined: Sep 03, 2011
Posts: 22
Thanks Amit ,it was useful (and i am laughing on myself).
 
 
subject: dynamic input field generation within the same page at defined location
 
Similar Threads
Input type attribute 'name' query?
my servlet can't initialize: null
how to identify duplicate form elements with same name in a funcation
validation for Inetger type field in Struts
How I can edit 'java.util.Set' DynaValidatorForm form-property