473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

add textbox to already created page using javascript

I have made a page. I need a provision that when a person selects the number of items from dropdown box ... that number of textboxes should be displayed so that he can enter description about all items...

I think this can either be done by -
1. displaying that number of boxes on the same page..
or
2. By popping a window with selected number of text boxes..

I want to do it by 1st method...

I think this is a simple problem... If anybody can help please.....
Jul 2 '07 #1
5 2452
gits
5,390 Expert Mod 4TB
hi ...

use a for-loop to create and append new textboxes with createElement(), appendChild()-methods. first create a empty div within your document where you want your boxes to appear - that acts as your textboxes-container ... append the textboxes then to it during the loop ...

hope i gave you the idea ... try something and ask more question when you have them ... post some code you tried ...

kind regards ...
Jul 2 '07 #2
thanks ....
the method is working but there is a problem...
For first change in selected value this works fine...
And the text boxes gets displayed..

but when I again change the value in the <select> tag new textboxes get appended to earlier made textboxes...


For this firstly I have to delete earlier added elements , but how?
Please guide me further.....
Jul 2 '07 #3
gits
5,390 Expert Mod 4TB
... loop through the elements in your div and use removeChild() ...

kind regards ...
Jul 2 '07 #4
... loop through the elements in your div and use removeChild() ...

kind regards ...
thanks
and my code is now working fine...
instead of adding textboxes I used different strategy..

I created div tag.. added needed number of textboxes to that tag and then add that tag to the main tag..

next time I just removed the old div tag and then created new div tag and add it..

Thanks again
Jul 2 '07 #5
gits
5,390 Expert Mod 4TB
glad you got it working ... ;)

come back if you have more questions ...

kind regards ...
Jul 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Gary | last post by:
Hello, Is it possible to dynamically update a textbox with words chosen from a list using form checkboxes and javascript? Gary
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
1
by: Raed Sawalha | last post by:
HI There, I have a webform and I am wanting to call a function from a textbox control located on the webform when a key is pressed. Can this be done in server side. already know do like this ...
2
by: R.A.M. | last post by:
Hello, Could you help me plase? I need to set Text property of TextBox when second page is displayed and active. On first page I have: Birth date: <asp:TextBox ID="BirthDate" runat="server"...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
10
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value...
13
by: Stever1975 | last post by:
I'm working on something similiar to a shopping cart item page. There is a table of items. Each item has an image, a textbox for the qty and an image for the add button. When the add image is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.