• 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

Creating text boxes dynamically

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Based on the number of letters in the string i need to create a group of text boxes dynamically.(using javascript)

suppose : the string contains the letters EXAMPLE , 7 textboxes should be created dynamically,

Anyone has an idea?
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use javascript and dhtml to achieve this.
try exploring the concept of innerHtml
 
Sanny kumar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harish,
i used the concept innerhtml.but my requirement is all the text boxes with the same name.


the code is as follows:

function changeIt()
{

for(s=1;s<=document.form.t1.value;s++)
{

my_div.innerHTML = my_div.innerHTML +"<br><input type='text' name='t1'>"
}}
}


if i change the text name in the onclick event it works..if i use the same name of text box inside <body> it wont work..

any idea....
 
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
Moved to the HTML/Javascript forum.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
document.form.t1.value is the string. You are missing length to get the number of characters entered.

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic