• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding more controls at runtime

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic