473,320 Members | 1,872 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,320 software developers and data experts.

Javascript: Refer to element within DIV tag

Hey,

I have a form, and I'm working on validation, half way through the form, I have a <DIV> tag that contains the rest of the elements in the form, it seems I can access the elements before the <DIV> tag, but not after, after googling I've found the getelementbyID function, but not sure if it will do what I want. Picture something like this:

Expand|Select|Wrap|Line Numbers
  1. <form>
  2. <input id="test" name="test">
  3. <div id="myDiv">
  4. <input id="test2" name="test2">
  5. </div>
  6. </form>
  7.  
I have some javascript referring to the test element with no issues, but if I try to refer to test2, it doesn't work. How would I go about referring to test2 when it's within a DIV?

As you can tell, I'm very new to this.

Thanks.
Aug 26 '10 #1

✓ answered by pradeepkr13

There are many ways to access form objects rather.
Without even using getElementById(). Check this.

3 2192
document.getElementById('test2').name
document.getElementById('test2').value
document.getElementById('test2').id
Aug 26 '10 #2
There are many ways to access form objects rather.
Without even using getElementById(). Check this.
Aug 26 '10 #3
Thanks! That helped out lots, I got it working.
Aug 26 '10 #4

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

Similar topics

2
by: Mark | last post by:
Hello I have a page with an inline frame "frameA" on it. Within the frame is a table and within that is a cell with the id "morebit" Previously I would set the innerHTML for this cell from the...
4
by: Martin Feuersteiner | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB...
1
by: Antoine | last post by:
I have a pretty quickish question about ASPX with codebehind. I have done an exhaustive search of the web so no go there. I was hoping to reach out for some help here. Anyway, I have a really...
1
by: vocalise | last post by:
The title probably isn't very clear, but I haven't been able to find this problem (or I must be having problems figuring out which search strings to use) so I apologize if this has been addressed...
1
by: sarwarmohiuddin | last post by:
Hello MAtes, I am having this problem of adding a script element in a rich text editor box. i am doing this. The problem is that it won't add the script tag alltogather, or give an error "Unknown...
8
by: RussellReal | last post by:
ok, lets say my main page "testingiframe.html" has this code in it: <html> <body> <iframe id="frame" src="testingsecondframe.html"> </body> </html> and inside...
2
by: HockeyFan | last post by:
Yesterday, I posted a question dealing with an issue of trying to reference (from javascript on the client side) an item within a Repeater. My code was hard-coded to use the actual ClientId, but...
1
by: asibin2000 | last post by:
I'm having problems with a VB.NET application. We have multiple web applications and we are using a VB.NET program to do a sort of Single Sign On. So this works great, the system automatically...
3
chathura86
by: chathura86 | last post by:
i want to select all ul tags with in a given div tag eg. <div id="a"> <ul> <li>asdad .....</li> <ul> <li>asdad .....</li> ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.