473,508 Members | 4,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing values of dynamic textbox in JavaScript

2 New Member
am using following code to generate textboxes dynamically.
textbox fields have the same name and id. i am going to add two textbox values in onblur event by using document.getElementById('textboxname').value
but it is taking only the first row values.
i want a solution like it works for all the rows?
plese help me ,thanks in advance


Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. function Add(id,nu)
  4. {    
  5.  
  6.     <%
  7.     for(int i=0;i<5;i++){%>
  8.     var table=document.getElementById(id);
  9.     var tbody=table.getElementsByTagName('TBODY')[0];
  10.     var newrow=tbody.appendChild(tbody.getElementsByTagName('TR')[0].cloneNode(true));
  11.  
  12.     newrow.getElementsByTagName('INPUT')[0].value='';
  13.  
  14.  
  15.     <%}%>
  16. }
  17. </script>
Apr 19 '12 #1
1 2434
Dormilich
8,658 Recognized Expert Moderator Expert
textbox fields have the same name and id. i am going to add two textbox values in onblur event by using document.getElementById('textboxname').value
but it is taking only the first row values.
of course. IDs have to be unique. hence you can’t get more than one element via ID.
Apr 19 '12 #2

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

Similar topics

1
1945
by: Kum | last post by:
Hi, I need help in asp.net dynamic textbox controls validation. I am creating textbox controls dynamically on a asp.net webpage. Now after creating the textboxes on the page I want to validate...
3
2169
by: DotNetNewbie | last post by:
I am reading the book Teach Yourself Microsoft Visual Basic .Net 2003 in 21 Days. I am having trouble getting one of the exercises to work at the end of day 4. Exercises: 1. Create a new...
2
3703
by: mwieder | last post by:
Given an html anchor button control, in javascript can I tell whether that control is set to cause validation or not? In ASP.NET the property that gets set is CausesValidatation, but in...
2
6442
by: Christina | last post by:
Hello !! I am creating a dynamic textbox and want to validate it using the requiredfieldvalidator. These are the steps which I tried: ==================================================== 1)...
1
2144
by: jeccinta jeccinta | last post by:
Hi, Am working in Asp.net using C#.I have 4 textboxes and 1 button in my application.After the user enters values in 4 textboxes he will click the button.On button click the values in textbox...
6
2944
by: chaituchaitu | last post by:
hi, i want to display previous values(max 5 recent values) in textbox, whenever the user try to enter the value in textbox. the textbox designed by using JSP.
9
4002
by: kumarrk | last post by:
Hi all, i am using place holder for dynamic textbox and label box, then when i enter the values in textbox then i click the add button and save to database, but i couldnt get the dynamic textbox...
2
1695
by: marisenthil | last post by:
how to get the value of the dynamic textbox by its id without using javascript?
4
2269
by: marisenthil | last post by:
How to access the value of the dynamic textbox by its id? I created more dynamic textbox using the below in loop Dim tb As New TextBox tb.ID = "txt_" + Str$(i) and it assigned unique...
0
7128
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
7332
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
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
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,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.