Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Creating text boxes dynamically

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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....
 
Marshal
Posts: 67463
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the HTML/Javascript forum.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
document.form.t1.value is the string. You are missing length to get the number of characters entered.

Eric
 
I can't take it! You are too smart for me! Here is the tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic