aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Adding more controls at runtime 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 "Adding more controls at runtime" Watch "Adding more controls at runtime" New topic
Author

Adding more controls at runtime

Vivian Josh
Ranch Hand

Joined: Oct 31, 2006
Posts: 112
Hi Ranchers,

I want to add more textboxes depending on need of the user. Can we do it in HTML?

Eg: I want to create something similar to what we have in gmail contacts. If user wants to add more that one phone number he can click on "add" link and new textbox appears on the screen. He if wants to remove that then he can click on "remove" link.

How can we create that in html/javascript? Can someone share that script or let me know where can I find it?

Any help is appreciated.

- Vivian
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

Originally posted by Vivian Josh:
I want to add more textboxes depending on need of the user. Can we do it in HTML?
No. You''ll also need to employ JavaScript.

How can we create that in html/javascript?
You can explore the innerHTML property of DOM elements, or learn the DOM manipulation API.

If you are going to dive into modifying the DOM dynamically, I definitely recommend adopting either of the jQuery or Prototype libraries which will make such things easier and help shield you from the browser differences.
[ February 27, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding more controls at runtime