Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding more controls at runtime

 
Vivian Josh
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64848
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic